pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Heikki Linnakangas <heikki@enterprisedb.com>
To: Gábor Farkas <gabor@nekomancer.net>
Cc: pgsql-performance@postgresql.org
Subject: Re: select count(*) performance (vacuum did not help)
Date: Mon, 24 Sep 2007 15:30:09 +0100
Message-ID: <46F7C9F1.1080805@enterprisedb.com> (raw)
In-Reply-To: <46F7C494.1050604@nekomancer.net>
References: <46F7C494.1050604@nekomancer.net>

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



view thread (9+ messages)  latest in thread

Message-ID: <46F7C9F1.1080805@enterprisedb.com>
Permalink:  ../46F7C9F1.1080805@enterprisedb.com/
Also on:    postgresql.org/message-id/46F7C9F1.1080805@enterprisedb.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: heikki@enterprisedb.com, gabor@nekomancer.net
  Subject: Re: select count(*) performance (vacuum did not help)
  In-Reply-To: <46F7C9F1.1080805@enterprisedb.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox