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