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

From: Rajesh Kumar Mallah <mallah(at)trade-india(dot)com>
To: Richard Huxton <dev(at)archonet(dot)com>
Cc: Postgres Performance <pgsql-performance(at)postgresql(dot)org>
Subject: Re: select count(*) very slow on an already vacuumed table.
Date: 2004-04-14 20:43:03
Message-ID: 407DA257.6010904@trade-india.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Richard Huxton wrote:

>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.
>
>

it is just an example. in general all the queries that involves eyp_rfi
become slow. reloading the table makes the query faster.

mallah.

>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"?
>
>
>

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message pginfo 2004-04-15 06:03:18 linux distro for better pg performance
Previous Message Simon Riggs 2004-04-14 20:12:18 Re: PostgreSQL and Linux 2.6 kernel.