Re: Changed to: how to solve the get next 100 records problem - Mailing list pgsql-sql

From PFC
Subject Re: Changed to: how to solve the get next 100 records problem
Date
Msg-id op.sqzfxct8th1vuj@localhost
Whole thread Raw
In response to Re: Does Postgresql have a similar pseudo-column "ROWNUM" as Oracle?  (Andrew Sullivan <ajs@crankycanuck.ca>)
List pgsql-sql

> The only strange thing is that without the 3rd order by, the order is  
> wrong. I didn't expect it because each select is created ordered. Is it  
> expected that UNION mixes it all up? (using postgre 7.4.1)
That's because UNION removes duplicates, which it will probably doing  
using a hash (EXPLAIN ANALYZE is your friend).Use UNION ALL because your WHERE condition allows no duplicates anyway.

UNION ALL preserves the order.So you can get the LIMIT out of the subqueries and put it around the  
UNION ALL.


pgsql-sql by date:

Previous
From: "Peter Bense"
Date:
Subject: Help with views/rules...
Next
From: Ragnar Hafstað
Date:
Subject: Re: Changed to: how to solve the get next 100 records problem