Re: "group by" is quite expensive

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: "group by" is quite expensive
Дата
Msg-id 17438.988843870@sss.pgh.pa.us
обсуждение исходный текст
Ответ на "group by" is quite expensive  ("Albertson, Chris" <CAlbertson@primeadvantage.com>)
Список pgsql-general
"Albertson, Chris" <CAlbertson@primeadvantage.com> writes:
> What can I do to speed up queries like the following

>    select count(*) from ttt group by xxx;

Not much at the user level, I'm afraid.  Currently GROUP BY requires
a sort on the grouping column, and that's expensive for a big table.

There has been talk of reimplementing GROUP BY to avoid sorting
(instead maintaining a hash table with one entry for each distinct
value of the grouping column), and it might get done for 7.2 or so.

            regards, tom lane

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

Предыдущее
От: Joel Burton
Дата:
Сообщение: Re: multiple INSERT
Следующее
От: Joel Burton
Дата:
Сообщение: Re: Security and performance