Re: Does it has a way to compact the database size? - Mailing list pgsql-general

From Richard Huxton
Subject Re: Does it has a way to compact the database size?
Date
Msg-id 45ED4454.7060301@archonet.com
Whole thread Raw
In response to Re: Does it has a way to compact the database size?  ("Premsun Choltanwanich" <Premsun@nsasia.co.th>)
List 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

pgsql-general by date:

Previous
From: "Premsun Choltanwanich"
Date:
Subject: Re: Does it has a way to compact the database size?
Next
From: Richard Huxton
Date:
Subject: Re: Postgres Mailing List management solution