Re: Sorted union

Поиск
Список
Период
Сортировка
От Kevin Grittner
Тема Re: Sorted union
Дата
Msg-id 436A0C8F0200002500000459@gwmta.wicourts.gov
обсуждение исходный текст
Ответ на Sorted union  (Scott Lamb <slamb@slamb.org>)
Список 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.moncure@rcsonline.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


В списке pgsql-performance по дате отправления:

Предыдущее
От: "Magnus Hagander"
Дата:
Сообщение: Re: insert performance for win32
Следующее
От: "Magnus Hagander"
Дата:
Сообщение: Re: insert performance for win32