From: | "Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov> |
---|---|
To: | <merlin(dot)moncure(at)rcsonline(dot)com>, <slamb(at)slamb(dot)org> |
Cc: | <pgsql-performance(at)postgresql(dot)org>, <dustin(at)spy(dot)net> |
Subject: | Re: Sorted union |
Date: | 2005-11-03 19:11:43 |
Message-ID: | 436A0C8F0200002500000459@gwmta.wicourts.gov |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-performance |
Just as an FYI, if you want to reassure yourself that the ORDER BY
is being applied as intended, you could do the following:
(
select 1 as hint, start_time as when [...]
union all
select 2 as hint, end_time as when [...]
) order by seq, when
This is ANSI/ISO standard, and works in PostgreSQL (based on
a quick test).
>>> "Merlin Moncure" <merlin(dot)moncure(at)rcsonline(dot)com> >>>
hmm, try pushing the union into a subquery...this is better style
because it's kind of ambiguous if the ordering will apply before/after
the union.
select q.when from
(
select 1 as hint, start_time as when [...]
union all
select 2 as hint, end_time as when [...]
) q order by q.seq, when
From | Date | Subject | |
---|---|---|---|
Next Message | Qingqing Zhou | 2005-11-03 20:25:42 | Re: insert performance for win32 |
Previous Message | Magnus Hagander | 2005-11-03 19:04:01 | Re: insert performance for win32 |