pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Heikki Linnakangas <heikki@enterprisedb.com>
To: Rafael Martinez <r.m.guerrero@usit.uio.no>
Cc: pgsql-performance@postgresql.org
Subject: Re: Need to run CLUSTER to keep performance
Date: Thu, 08 Nov 2007 15:09:55 +0000
Message-ID: <473326C3.3070206@enterprisedb.com> (raw)
In-Reply-To: <47332200.9050705@usit.uio.no>
References: <4732E6B4.1030907@usit.uio.no>
	<4732EF07.3060807@enterprisedb.com>
	<47332200.9050705@usit.uio.no>

Rafael Martinez wrote:
> Heikki Linnakangas wrote:
>> On a small table like that you could run VACUUM every few minutes
>> without much impact on performance. That should keep the table size in
>> check.
> 
> Ok, we run VACUUM ANALYZE only one time a day, every night. But we would
> espect the performance to get ok again after running vacuum, and it
> doesn't. Only CLUSTER helps.

If the table is already bloated, a VACUUM won't usually shrink it. It 
only makes the space available for reuse, but a sequential scan still 
needs to go through a lot of pages.

CLUSTER on the other hand repacks the tuples and gets rid of all the 
unused space on pages. You need to run CLUSTER or VACUUM FULL once to 
shrink the relation, but after that frequent-enough VACUUMs should keep 
the table size down.

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



view thread (21+ messages)  latest in thread

Message-ID: <473326C3.3070206@enterprisedb.com>
Permalink:  ../473326C3.3070206@enterprisedb.com/
Also on:    postgresql.org/message-id/473326C3.3070206@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, r.m.guerrero@usit.uio.no
  Subject: Re: Need to run CLUSTER to keep performance
  In-Reply-To: <473326C3.3070206@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