Re: Overhead of union versus union all

Поиск
Список
Период
Сортировка
От Scott Bailey
Тема Re: Overhead of union versus union all
Дата
Msg-id 4A569F93.8040504@comcast.net
обсуждение исходный текст
Ответ на Re: Overhead of union versus union all  (Alvaro Herrera <alvherre@commandprompt.com>)
Ответы Re: Overhead of union versus union all  (Bruce Momjian <bruce@momjian.us>)
Список pgsql-general
Alvaro Herrera wrote:
> Tim Keitt wrote:
>> I am combining query results that I know are disjoint. I'm wondering
>> how much overhead there is in calling union versus union all. (Just
>> curious really; I can't see a reason not to use union all.)
>
> UNION needs to uniquify the output, for which it plasters an additional
> sort step, whereas UNION ALL does not need to uniquify its output and
> thus it can avoid the sort step.  Using UNION ALL is recommended
> wherever possible.
>

I think I read somewhere that as of 8.4 it no longer required the sort
step, due to the improvements in hashing. Here it is

http://wiki.postgresql.org/wiki/WhatsNew84#Performance

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

Предыдущее
От: Bret Fledderjohn
Дата:
Сообщение: Re: ubuntu packages for 8.4
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: Overhead of union versus union all