Re: union vs. sort - Mailing list pgsql-hackers

From Tom Lane
Subject Re: union vs. sort
Date
Msg-id 24947.1081362055@sss.pgh.pa.us
Whole thread Raw
In response to Re: union vs. sort  (Karel Zak <zakkr@zf.jcu.cz>)
Responses Re: union vs. sort  (Karel Zak <zakkr@zf.jcu.cz>)
List pgsql-hackers
Karel Zak <zakkr@zf.jcu.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
topset operation is UNION        * ALL, since the appended-together results are unsorted even if        * the subplans
weresorted.  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


pgsql-hackers by date:

Previous
From: Andrew Dunstan
Date:
Subject: Re: locale
Next
From: Tom Lane
Date:
Subject: Re: locale