Re: Does it has a way to compact the database size?

From: Richard Huxton <dev(at)archonet(dot)com>
To: Premsun Choltanwanich <Premsun(at)nsasia(dot)co(dot)th>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Does it has a way to compact the database size?
Date: 2007-03-06 10:37:08
Message-ID: 45ED4454.7060301@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Premsun Choltanwanich wrote:
> Does it has a way to schedule the process for make sure that i'm running VACUUM
> often enough? How?
> (ie. create some script on PostgreSQL from running VACUUM FULL on 3.00 AM for
> first date of every month.)

You might want to look at "autovacuum" in the contrib/ directory of the
source, or the equivalent package for your platform. It's part of the
core system in later versions.

Otherwise, there's a command-line "vacuumdb" tool which you can schedule
from cron (man 1 crontab / man 5 crontab). Depending on update activity
you might want to run a normal vacuum daily and vacuum full weekly, or
perhaps vacuum hourly and vacuum full overnight. You'll want to set the
max_fsm_xxx parameters in your postgresql.conf once you have things
running normally. There's a "verbose" option for vacuum full which can
help suggest values for these.

First of all though, run a vacuum full/reindex to compact everything,
then run vacuum regularly.

--
Richard Huxton
Archonet Ltd

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Richard Huxton 2007-03-06 10:44:55 Re: Postgres Mailing List management solution
Previous Message Premsun Choltanwanich 2007-03-06 10:09:44 Re: Does it has a way to compact the database size?