Re: [HACKERS] union vs. sort

2004-04-08 Thread Karel Zak
On Wed, Apr 07, 2004 at 02:20:55PM -0400, Tom Lane wrote: > > I've committed changes to do the right thing in CVS tip. Thanks man! Karel -- Karel Zak <[EMAIL PROTECTED]> http://home.zf.jcu.cz/~zakkr/ ---(end of broadcast)--- TIP 3: if po

Re: [HACKERS] union vs. sort

2004-04-07 Thread Tom Lane
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 -- tha

Re: [HACKERS] union vs. sort

2004-04-07 Thread Karel Zak
On Tue, Apr 06, 2004 at 10:33:25AM -0400, Tom Lane wrote: > Karel Zak <[EMAIL PROTECTED]> writes: > > I'm surprise with query plan that PostgreSQL planner prepare for > > selects with ORDER BY if all data are from sub-select that is already > > sorted. > > This isn't simply a matter of

Re: [HACKERS] union vs. sort

2004-04-06 Thread Tom Lane
Karel Zak <[EMAIL PROTECTED]> writes: > I'm surprise with query plan that PostgreSQL planner prepare for > selects with ORDER BY if all data are from sub-select that is already > sorted. This isn't simply a matter of "omitting the sort". Even if the inputs are sorted, their concatenat

[HACKERS] union vs. sort

2004-04-06 Thread Karel Zak
I'm surprise with query plan that PostgreSQL planner prepare for selects with ORDER BY if all data are from sub-select that is already sorted. # explain select data from (select distinct data from addr) as x order by x.data;