Re: Overhead of union versus union all
От
Scott Marlowe
Тема
Re: Overhead of union versus union all
Дата
Msg-id
dcc563d10907091941h597b788o8c97e1f5a512cbd6@mail.gmail.com
Ответ на
Re: Overhead of union versus union all (Bruce Momjian)
Список
Дерево обсуждения
Overhead of union versus union all Tim Keitt <tkeitt@keittlab.org>
Re: Overhead of union versus union all Alvaro Herrera <alvherre@commandprompt.com>
Re: Overhead of union versus union all Bruce Momjian <bruce@momjian.us>
Re: Overhead of union versus union all Scott Bailey <artacus@comcast.net>
Re: Overhead of union versus union all Bruce Momjian <bruce@momjian.us>
Re: Overhead of union versus union all Scott Marlowe <scott.marlowe@gmail.com>
Re: Overhead of union versus union all Simon Riggs <simon@2ndQuadrant.com>
Re: Overhead of union versus union all Bruce Momjian <bruce@momjian.us>
Re: Overhead of union versus union all Simon Riggs <simon@2ndQuadrant.com>
Re: Overhead of union versus union all Jeff Davis <pgsql@j-davis.com>
Re: Overhead of union versus union all Greg Stark <gsstark@mit.edu>
Re: Overhead of union versus union all Jeff Davis <pgsql@j-davis.com>
Re: Overhead of union versus union all Scott Marlowe <scott.marlowe@gmail.com>
Re: Overhead of union versus union all Bruce Momjian <bruce@momjian.us>
Re: Overhead of union versus union all Simon Riggs <simon@2ndQuadrant.com>
Re: Overhead of union versus union all Bruce Momjian <bruce@momjian.us>
Re: Overhead of union versus union all Simon Riggs <simon@2ndQuadrant.com>
Re: Overhead of union versus union all Bruce Momjian <bruce@momjian.us>
Re: Overhead of union versus union all Adam Rich <adam.r@sbcglobal.net>
On Thu, Jul 9, 2009 at 7:58 PM, Bruce Momjian wrote: > Scott Bailey wrote: >> 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 > > Oh, yea, hashing is used in some cases rather than sort. I assume sort > is still used if the hash exceeds workmem size. The important point being that it's still more expensive than a plain union all thought, right?
В списке pgsql-general по дате отправления