Re: select count(*) very slow on an already vacuumed table.

Поиск
Список
Период
Сортировка
От Richard Huxton
Тема Re: select count(*) very slow on an already vacuumed table.
Дата
Msg-id 200404142008.58533.dev@archonet.com
обсуждение исходный текст
Ответ на select count(*) very slow on an already vacuumed table.  (Rajesh Kumar Mallah <mallah@trade-india.com>)
Ответы Re: select count(*) very slow on an already vacuumed table.  (Rajesh Kumar Mallah <mallah@trade-india.com>)
Re: select count(*) very slow on an already vacuumed table.  (Rajesh Kumar Mallah <mallah@trade-india.com>)
Список pgsql-performance
On Wednesday 14 April 2004 18:53, Rajesh Kumar Mallah wrote:
> Hi
> I have .5 million rows in a table. My problem is select count(*) takes
> ages. VACUUM FULL does not help. can anyone please tell me
> how to i enhance the performance of the setup.

> SELECT count(*) from eyp_rfi;

If this is the actual query you're running, and you need a guaranteed accurate
result, then you only have one option: write a trigger function to update a
table_count table with every insert/delete to eyp_rfi.

There is loads of info on this (and why it isn't as simple as you might think)
in the archives. First though:
1. Is this the actual query, or just a representation?
2. Do you need an accurate figure or just something "near enough"?

--
  Richard Huxton
  Archonet Ltd

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

Предыдущее
От: Rajesh Kumar Mallah
Дата:
Сообщение: select count(*) very slow on an already vacuumed table.
Следующее
От: "Simon Riggs"
Дата:
Сообщение: Re: PostgreSQL and Linux 2.6 kernel.