Received: from localhost (unknown [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id 5CE359F9E30 for ; Sat, 22 Sep 2007 03:07:39 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.191]) (amavisd-maia, port 10024) with ESMTP id 55301-04 for ; Sat, 22 Sep 2007 03:07:35 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 358019F9DD7 for ; Sat, 22 Sep 2007 03:07:35 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.1/8.14.1) with ESMTP id l8M67SDW009260; Sat, 22 Sep 2007 02:07:28 -0400 (EDT) To: Denes Daniel cc: pgsql-performance@postgresql.org Subject: Re: Query planner unaware of possibly best plan In-reply-to: References: Comments: In-reply-to Denes Daniel message dated "Sat, 22 Sep 2007 02:08:43 +0200" Date: Sat, 22 Sep 2007 02:07:28 -0400 Message-ID: <9259.1190441248@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200709/395 X-Sequence-Number: 26940 Denes Daniel writes: > Simon Riggs wrote: >> Make the case. **I** want it is not sufficient... > Sorry, I can't understand that... I'm far from perfect in english. The point here is that you've repeated the same example N times without actually making a case that it's interesting to support. We have to think about the intellectual complexity that would be added to the planner to support this case, and the cycles that would be expended on every query (and wasted, for most queries) on trying to detect whether the case applies. If it were simple and cheap to do, these arguments wouldn't hold much weight, but it doesn't look to me like either is the case. Another problem is that it's not clear there's much to be gained. Avoiding the sort step is only interesting if the query produces so many rows that a sort would be expensive ... but if that's the case, it seems unlikely that a nestloop indexscan plan would be the best choice anyway. So basically this looks like a lot of work for a narrow and questionable gain. If you want it to happen you need to convince people that it's easier and more useful than it looks. regards, tom lane