Re: Any better plan for this query?..

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Simon Riggs <simon(at)2ndQuadrant(dot)com>
Cc: Matthew Wakeling <matthew(at)flymine(dot)org>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, 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 14:00:36
Message-ID: 2C5DC170-01E7-4756-8A2B-F945997DD47A@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On May 19, 2009, at 7:36 AM, Simon Riggs <simon(at)2ndQuadrant(dot)com> wrote:

>
> On Tue, 2009-05-19 at 12:17 +0100, Matthew Wakeling wrote:
>> Yes, Postgres has been missing the boat on this one for a while. +1
>> on
>> requesting this feature.
>
> That's an optimizer feature.
>
>> Speaking of avoiding large sorts, I'd like to push again for partial
>> sorts. This is the situation where an index provides data sorted by
>> column "a", and the query requests data sorted by "a, b". Currently,
>> Postgres sorts the entire data set, whereas it need only group each
>> set of identical "a" and sort each by "b".
>
> This is an executor feature.
>
> Partially sorted data takes much less effort to sort (OK, not zero, I
> grant) so this seems like a high complexity, lower value feature. I
> agree it should be on the TODO, just IMHO at a lower priority than
> some
> other features.

I have no particular thoughts on priority (whose priority?), but I
will say I've run across queries that could benefit from this
optimization. I fairly often write queries where the first key is
mostly unique and the second is just to make things deterministic in
the event of a tie. So the partial sort would be almost no work at all.

...Robert

>
>
> --
> Simon Riggs www.2ndQuadrant.com
> PostgreSQL Training, Services and Support
>
>
> --
> Sent via pgsql-performance mailing list (pgsql-performance(at)postgresql(dot)org
> )
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-performance

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Dimitri 2009-05-19 14:51:55 Re: Any better plan for this query?..
Previous Message Simon Riggs 2009-05-19 13:35:37 Re: Any better plan for this query?..