count(*) slow on large tables

Поиск
Список
Период
Сортировка
От Dror Matalon
Тема count(*) slow on large tables
Дата
Msg-id 20031002191547.GZ87525@rlx11.zapatec.com
обсуждение исходный текст
Ответы Re: count(*) slow on large tables  (Bruno Wolff III <bruno@wolff.to>)
Re: count(*) slow on large tables  (Tomasz Myrta <jasiek@klaster.net>)
Список pgsql-performance
Hi,

I have a somewhat large table, 3 million rows, 1 Gig on disk,  and growing. Doing a
count(*) takes around 40 seconds.

Looks like the count(*) fetches the table from disk and goes through it.
Made me wonder, why the optimizer doesn't just choose the smallest index
which in my case is around 60 Megs and goes through it, which it could
do in a fraction of the time.

Dror


--
Dror Matalon
Zapatec Inc
1700 MLK Way
Berkeley, CA 94709
http://www.zapatec.com

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

Предыдущее
От: Bill Moran
Дата:
Сообщение: Re: low cardinality column
Следующее
От: Bruno Wolff III
Дата:
Сообщение: Re: count(*) slow on large tables