From: | "Steve Wolfe" <steve(at)iboats(dot)com> |
---|---|
To: | "PostGreSQL" <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Running vacuum on cron |
Date: | 2001-10-29 18:03:29 |
Message-ID: | 001401c160a4$04e98380$50824e40@iboats.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
> Hi. Is there any way to put a vacuum and a vacuum analyze (the
> second does everything the first does? Or do I need to use both?) in a
cron
> so that it is executed nightly?
# crontab -e -u postgres
0 0 * * * vacuumdb --all --analyze
Depending on your path and binary locations, you may have to fully
qualify the "vacuumdb" command, such as
"/usr/local/pgsql/bin/vacuumdb --all --analyze". You can also take the
opportunity to do backup stuff if you want, here's a simple example:
----------
#!/bin/sh
/usr/local/pgsql/bin/vacuumdb --all --analyze
DATESTAMP=`date +%B_%d_%Y__%H:%M:%S`
BACKUPDIR=/usr/local/pgsql/backup
FILENAME=pg_daily_backup__${DATESTAMP}.bz
/usr/local/pgsql/bin/pg_dumpall | /usr/bin/bzip2 > $BACKUPDIR/$FILENAME
---------------
The location where you put the backups should be included in your normal
file backup routine. Keeping a second copy on a trusted machine (say,
your file server) also makes it easier to get a file if things go very bad
in a hurry.
steve
From | Date | Subject | |
---|---|---|---|
Next Message | Stephan Szabo | 2001-10-29 18:03:32 | Re: concurrency performance degradation |
Previous Message | Chris Green | 2001-10-29 18:01:26 | bug in interval/extract or am I abusing interval()? |