Karel Zak <[EMAIL PROTECTED]> 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 ---------------------------(end of broadcast)--------------------------- TIP 4: Don't 'kill -9' the postmaster