Re: Query planner unaware of possibly best plan

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Denes Daniel <panther-d(at)freemail(dot)hu>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Query planner unaware of possibly best plan
Date: 2007-09-22 06:07:28
Message-ID: 9259.1190441248@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Denes Daniel <panther-d(at)freemail(dot)hu> writes:
> Simon Riggs <simon(at)2ndquadrant(dot)com> 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

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Greg Smith 2007-09-22 06:29:17 Re: Low CPU Usage
Previous Message Denes Daniel 2007-09-22 00:08:43 Re: Query planner unaware of possibly best plan