From: | Simon Riggs <simon(at)2ndQuadrant(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Dimitri <dimitrik(dot)fr(at)gmail(dot)com>, Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>, Dimitri Fontaine <dfontaine(at)hi-media(dot)com>, Alvaro Herrera <alvherre(at)commandprompt(dot)com>, Aidan Van Dyk <aidan(at)highrise(dot)ca>, Merlin Moncure <mmoncure(at)gmail(dot)com>, PostgreSQL Performance <pgsql-performance(at)postgresql(dot)org> |
Subject: | Re: Any better plan for this query?.. |
Date: | 2009-05-19 13:10:29 |
Message-ID: | 1242738629.14551.198.camel@ebony.2ndQuadrant |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-performance |
On Tue, 2009-05-19 at 08:58 -0400, Tom Lane wrote:
> Simon Riggs <simon(at)2ndQuadrant(dot)com> writes:
> > Both plans for this query show an IndexScan on a two column-index, with
> > an Index Condition of equality on the leading column. The ORDER BY
> > specifies a sort by the second index column, so the top-level Sort is
> > superfluous in this case.
>
> > My understanding is that we don't currently eliminate superfluous
> > additional sorts of this kind.
>
> Nonsense. The planner might think some other plan is cheaper, but
> it definitely knows how to do this, and has since at least 8.1.
Please look at Dimitri's plan. If it can remove the pointless sort, why
does it not do so?
I agree that it will remove a Sort when the data is already has the
exact same interesting sort order. In this case the sort order is not
exactly the same, but looks fully removable to me.
--
Simon Riggs www.2ndQuadrant.com
PostgreSQL Training, Services and Support
From | Date | Subject | |
---|---|---|---|
Next Message | Simon Riggs | 2009-05-19 13:19:52 | Re: Any better plan for this query?.. |
Previous Message | Merlin Moncure | 2009-05-19 13:05:01 | Re: Any better plan for this query?.. |