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

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

From: "Heikki Linnakangas" <heikki(at)enterprisedb(dot)com>
To: Gábor Farkas <gabor(at)nekomancer(dot)net>
Cc: <pgsql-performance(at)postgresql(dot)org>
Subject: Re: select count(*) performance (vacuum did not help)
Date: 2007-09-24 14:30:09
Message-ID: 46F7C9F1.1080805@enterprisedb.com (view raw or flat)
Thread:
Lists: pgsql-performance
Gábor Farkas wrote:
> - this table has a lot of updates and inserts, it works very similarly
> to a session-table for a web-application

Make sure you run VACUUM often enough.

> - there is a cron-job that deletes all the old entries, so it's size is
> rougly between 15000 and 35000 entries (it's run daily, and every day
> deletes around 10000 entries)

Running vacuum after these deletes to immediately reclaim the dead space
would also be a good idea.

> - but in the past, the cron-job was not in place, so the table's size
> grew to around 800000 entries (in around 80 days)

That bloated your table, so that there's still a lot of empty pages in
it. VACUUM FULL should bring it back to a reasonable size. Regular
normal non-FULL VACUUMs should keep it in shape after that.

-- 
  Heikki Linnakangas
  EnterpriseDB   http://www.enterprisedb.com

In response to

Responses

pgsql-performance by date

Next:From: Gábor FarkasDate: 2007-09-24 15:04:39
Subject: Re: select count(*) performance (vacuum did not help)
Previous:From: Pavan DeolaseeDate: 2007-09-24 14:23:49
Subject: Re: select count(*) performance (vacuum did not help)

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