Received: from localhost (wm.hub.org [200.46.204.128]) by postgresql.org (Postfix) with ESMTP id 1EEF09FB3C5 for ; Thu, 12 Oct 2006 13:46:19 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.128]) (amavisd-new, port 10024) with ESMTP id 36863-04 for ; Thu, 12 Oct 2006 16:46:10 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey- Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id 1FB489FB399 for ; Thu, 12 Oct 2006 13:46:10 -0300 (ADT) Received: by noel.decibel.org (Postfix, from userid 1001) id 20DA456431; Thu, 12 Oct 2006 11:46:09 -0500 (CDT) Received: (hashcash-sendmail, from uid 1001); Thu, 12 Oct 2006 11:46:07 -0500 Date: Thu, 12 Oct 2006 11:46:07 -0500 From: "Jim C. Nasby" To: Joshua Marsh Cc: pgsql-performance@postgresql.org Subject: Re: Hints proposal Message-ID: <20061012164607.GH28647@nasby.net> References: <20061012151439.GT28647@nasby.net> <38242de90610120826l5328759bt41468644e54badae@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <38242de90610120826l5328759bt41468644e54badae@mail.gmail.com> X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.11 X-Hashcash: 1:20:061012:icub3d@gmail.com::O5+D1vFY2ASBA1qz:0EQ8L X-Hashcash: 1:20:061012:pgsql-performance@postgresql.org::lRFCF4KWyMY4X0HG:00000 0000000000000000000000001bV9 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200610/247 X-Sequence-Number: 21376 On Thu, Oct 12, 2006 at 09:26:24AM -0600, Joshua Marsh wrote: > On 10/12/06, Jim C. Nasby wrote: > > > >Posting here instead of hackers since this is where the thread got > >started... > > > >The argument has been made that producing a hints system will be as hard > >as actually fixing the optimizer. There's also been clamoring for an > >actual proposal, so here's one that (I hope) wouldn't be very difficult > >to implemen. > > > >My goal with this is to keep the coding aspect as simple as possible, so > >that implementation and maintenance of this isn't a big burden. Towards > >that end, these hints either tell the planner specifically how to handle > >some aspect of a query, or they tell it to modify specific cost > >estimates. My hope is that this information could be added to the > >internal representation of a query without much pain, and that the > >planner can then use that information when generating plans. > > > I've been following the last thread with a bit of interest. I like the > proposal. It seems simple and easy to use. What is it about hinting that > makes it so easily breakable with new versions? I don't have any experience > with Oracle, so I'm not sure how they screwed logic like this up. Hinting > to use a specific merge or scan seems fairly straight forward; if the query > requests to use an index on a join, I don't see how hard it is to go with > the suggestion. It will become painfully obvious to the developer if his > hinting is broken. The problem is that when you 'hint' (which is actually not a great name for the first part of my proposal, since it's really forcing the planner to do something), you're tying the planner's hands. As the planner improves in newer versions, it's very possible to end up with forced query plans that are much less optimal than what the newer planner could come up with. This is especially true as new query execution nodes are created, such as hashaggregate. The other downside is that it's per-query. It would certainly be useful to be able to nudge the planner in the right direction on a per-table level, but it's just not clear how to accomplish that. Like I said, the idea behind my proposal is to have something that can be done soon, like for 8.3. -- Jim Nasby jim@nasby.net EnterpriseDB http://enterprisedb.com 512.569.9461 (cell)