Skip site navigation (1) Skip section navigation (2)

Re: select count(*) performance (vacuum did not help)

From: Csaba Nagy <nagy(at)ecircle-ag(dot)com>
To: Gábor Farkas <gabor(at)nekomancer(dot)net>
Cc: Heikki Linnakangas <heikki(at)enterprisedb(dot)com>, pgsql-performance(at)postgresql(dot)org
Subject: Re: select count(*) performance (vacuum did not help)
Date: 2007-09-24 15:34:16
Message-ID: 1190648056.4661.251.camel@PCD12478 (view raw or flat)
Thread:
Lists: pgsql-performance
On Mon, 2007-09-24 at 17:14 +0200, Gábor Farkas wrote:
> will i achieve the same thing by simply dropping that table and 
> re-creating it?

If you have an index/PK on that table, the fastest and most useful way
to rebuild it is to do CLUSTER on that index. That will be a lot faster
than VACUUM FULL and it will also order your table in index order... but
it will also lock it in exclusive mode just as VACUUM FULL would do it.
If your table has just a few live rows and lots of junk in it, CLUSTER
should be fast enough. With 20K entries I would expect it to be fast
enough not to be a problem...

Cheers,
Csaba.



In response to

pgsql-performance by date

Next:From: Dave DutcherDate: 2007-09-24 15:37:42
Subject: Re: select count(*) performance (vacuum did not help)
Previous:From: Alexander StauboDate: 2007-09-24 15:29:48
Subject: Re: TEXT or LONGTEXT?

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group