Indices for select count(*)?

Поиск
Список
Период
Сортировка
От Alexander Scholz
Тема Indices for select count(*)?
Дата
Msg-id dobcn0$24ur$1@news.hub.org
обсуждение исходный текст
Ответ на Re: Newbie Question: FAQ for database optimization?  ("A. Kretschmer" <andreas.kretschmer@schollglas.com>)
Ответы Re: Indices for select count(*)?  (Peter Eisentraut <peter_e@gmx.net>)
Re: Indices for select count(*)?  (Greg Stark <gsstark@mit.edu>)
Re: Indices for select count(*)?  (Nicolas Barbier <nicolas.barbier@gmail.com>)
Список pgsql-general
Hi, thank you for your answer.

Regarding the performance flow when trying to find out how many records
are currently being stored in the table, I don't see how an index should
help... Nevertheless we've created an unique index on "ID" but SELECT
count("ID") from "XYZ" still takes 35 seconds*. (ID is the primary key
basing on a sequence, select count(*) isn't faster.)

So - what kind of indexing would speed this up then?

Thanx in advance!

Alexander.

*) MSSQL 2005 on the same server takes 4 seconds for this query for the
analogue table, and there hasn't any special tuning been applied, too.

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

Предыдущее
От: S McLurkin
Дата:
Сообщение: contrib extenstions
Следующее
От: Klein Balázs
Дата:
Сообщение: view or index to optimize performance