Re: select count(*) performance

From: "Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov>
To: "valgog" <valgog(at)gmail(dot)com>,<runic <runic(at)gmx(dot)de>, <pgsql-performance(at)postgresql(dot)org>
Subject: Re: select count(*) performance
Date: 2007-08-13 14:07:03
Message-ID: 46C01F36.EE98.0025.0@wicourts.gov
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

>>> valgog <valgog(at)gmail(dot)com> 08/13/07 6:38 AM >>>
On Aug 11, 5:54 pm, Detlef Rudolph <ru(dot)(dot)(dot)(at)gmx(dot)de> wrote:
>
> I've tried the VACUUM ANALYSE, that doesn't help
> much, but VACUUM FULL improves Performance down
> from about 40 secs to 8.

Det,

I don't think anyone meant to suggest that VACUUM ANALYZE would improve the
count speed on a table which had become bloated, but its routine use would
PREVENT a table from becoming bloated. Once bloat occurs, you need more
agressive maintenance, like VACUUM FULL or CLUSTER.

VACUUM FULL tends to cause index bloat, so you will probably see performance
issues in other queries at the moment. You will probably need to REINDEX
the table or use CLUSTER to clean that up.

-Kevin

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Jonathan Ellis 2007-08-13 15:04:07 Re: How to ENABLE SQL capturing???
Previous Message Vivek Khera 2007-08-13 13:50:11 Re: Dell Hardware Recommendations