Re: Overhead of union versus union all

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема Re: Overhead of union versus union all
Дата
Msg-id 20090709200513.GO6414@alvh.no-ip.org
обсуждение исходный текст
Ответ на Overhead of union versus union all  (Tim Keitt <tkeitt@keittlab.org>)
Ответы Re: Overhead of union versus union all
Re: Overhead of union versus union all
Список pgsql-general
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.

--
Alvaro Herrera                                http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.

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

Предыдущее
От: Tim Keitt
Дата:
Сообщение: Overhead of union versus union all
Следующее
От: Adam Rich
Дата:
Сообщение: Re: Overhead of union versus union all