Re: count(*) slow on large tables

Поиск
Список
Период
Сортировка
Искать
От
Tomasz Myrta
Тема
Re: count(*) slow on large tables
Дата
Msg-id
3F7C7E4A.9080803@klaster.net
Ответ на
Список
Дерево обсуждения
Re: count(*) slow on large tables Harald Fuchs <nospam@sap.com>
> 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

Just like other aggregate functions, count(*) won't use indexes when 
counting whole table.

Regards,
Tomasz Myrta

В списке pgsql-performance по дате отправления
От: Bruno Wolff III
Дата:
От: Oleg Lebedev
Дата:
Сообщение: Re: TPC-R benchmarks
FAQ