How to optimize select count(*)..group by?

Поиск
Список
Период
Сортировка
Искать
От
Bryan Field-Elliot
Тема
How to optimize select count(*)..group by?
Дата
Msg-id
1122567589.3880.19.camel@localhost.localdomain
Список
Дерево обсуждения
How to optimize select count(*)..group by? Bryan Field-Elliot <bryan_lists@netmeme.org>
Re: How to optimize select count(*)..group by? Scott Marlowe <smarlowe@g2switchworks.com>
Re: How to optimize select count(*)..group by? David Fetter <david@fetter.org>
Re: How to optimize select count(*)..group by? Bricklen Anderson <BAnderson@PresiNET.com>
Re: How to optimize select count(*)..group by? Richard Huxton <dev@archonet.com>
Re: How to optimize select count(*)..group by? Greg Stark <gsstark@mit.edu>
We have this simple query:

select status, count(*) from customer group by status;

There is already a btree index on status, but, the customer table is huge, and this query must be executed very frequently... an "explain" on this query shows that it is quite costly (and we notice it runs slowly)...

Can someone recommend the best technique to optimize this? We can create new indices, we can re-write this query.. But we'd rather not add new tables or columns if possible (not just to solve this problem).

Thank you,

Bryan

В списке pgsql-general по дате отправления
От: Bryan Field-Elliot
Дата:
Сообщение:
От: David Fetter
Дата:
FAQ