Re: count(*) index

Поиск
Список
Период
Сортировка
От Bruno Wolff III
Тема Re: count(*) index
Дата
Msg-id 20050107194541.GA15048@wolff.to
обсуждение исходный текст
Ответ на count(*) index  (Tomka Gergely <tomka@zeus.gau.hu>)
Список pgsql-novice
On Fri, Jan 07, 2005 at 19:22:56 +0100,
  Tomka Gergely <tomka@zeus.gau.hu> wrote:
> Hi!
>
> Yes, i know, mvcc, and can't use indexes. And i know the workaround for
> max() and min(). Is there some workaround for count()?
>
> select count(*) from table where field=1;
>
> and field has a nice index. And this is slooooow.

If there are few records where field=1 then an index will be used.

You may get better performance maintaining a count table using triggers.
This may not work well of there are lots of concurrent updates.

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

Предыдущее
От: "Julie Cottin"
Дата:
Сообщение: Driver Information Please
Следующее
От: Jeffrey Melloy
Дата:
Сообщение: Re: Duplicating A Row