Re: union vs. sort

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Karel Zak <zakkr(at)zf(dot)jcu(dot)cz>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: union vs. sort
Date: 2004-04-07 18:20:55
Message-ID: 24947.1081362055@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Karel Zak <zakkr(at)zf(dot)jcu(dot)cz> writes:
> On Tue, Apr 06, 2004 at 10:33:25AM -0400, Tom Lane wrote:
>> This isn't simply a matter of "omitting the sort".

> I didn't talk about "Append" result, but about "Unique" result. The
> ORDER BY in UNION query works with final concanated data -- that's
> right. My question is why a result from this ORDER BY is again sorted:

Oh, okay, that's just something that never got done, per this old
comment:

/*
* We set current_pathkeys NIL indicating we do not know sort
* order. This is correct when the top set operation is UNION
* ALL, since the appended-together results are unsorted even if
* the subplans were sorted. For other set operations we could be
* smarter --- room for future improvement!
*/

I've committed changes to do the right thing in CVS tip.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2004-04-07 18:29:16 Re: locale
Previous Message Andrew Dunstan 2004-04-07 17:52:57 Re: locale