Re: LIMIT within UNION?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andrew Perrin <clists(at)perrin(dot)socsci(dot)unc(dot)edu>
Cc: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>, pgsql-sql(at)postgresql(dot)org
Subject: Re: LIMIT within UNION?
Date: 2002-09-12 20:18:19
Message-ID: 9596.1031861899@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Andrew Perrin <clists(at)perrin(dot)socsci(dot)unc(dot)edu> writes:
> Interesting - this would count on the UNION including all cases in the
> first query before those in the second query. Are UNIONed records
> presented in any predictable order?

If you can use UNION ALL then this would be pretty safe to rely on.
If you must use UNION (to eliminate dups) then it won't work.

regards, tom lane

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Josh Berkus 2002-09-12 20:20:28 Re: LIMIT within UNION?
Previous Message Andrew Perrin 2002-09-12 20:03:54 Re: LIMIT within UNION?