Re: How to "unique-ify" HUGE table?

Поиск
Список
Период
Сортировка
От Scott Marlowe
Тема Re: How to "unique-ify" HUGE table?
Дата
Msg-id dcc563d10812231037p1c5b08cfpe34a363ccaa6b37b@mail.gmail.com
обсуждение исходный текст
Ответ на Re: How to "unique-ify" HUGE table?  ("George Pavlov" <gpavlov@mynewplace.com>)
Ответы Re: How to "unique-ify" HUGE table?
Список pgsql-performance
On Tue, Dec 23, 2008 at 11:14 AM, George Pavlov <gpavlov@mynewplace.com> wrote:
> You don't say what PG version you are on, but just for kicks you may try
> using GROUP BY instead of DISTINCT. Yes, the two should perform the
> same, but with 8.1 (or maybe 8.0) I had seen situations where GROUP BY
> was faster (admittedly this happened with more complex queries). So, try
> this:

Even in 8.3 it looks like group by is faster.  Tested it on a decent
sized table and group by used a hash agg and ran in ~600 ms, while
distinct used a sort and ran in 1300 ms.  That was on 500k rows.  On a
much larger table, one with about 10M rows, a similar statement runs
in 1500 ms with group by and in 2390 ms when run with distinct.

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

Предыдущее
От: "George Pavlov"
Дата:
Сообщение: Re: How to "unique-ify" HUGE table?
Следующее
От: Stefan Kaltenbrunner
Дата:
Сообщение: Re: How to "unique-ify" HUGE table?