This document describes how to vacuum the postgres database in Microsoft Windows and Linux.
It is absolutely critical to vacuum postgres databases in order for the databases to properly function. Through the life of the database, new entries are added and current entries are updated. By design, postgres does not immediately remove the iterations of a record as it gets updated. Therefore, postgres databases can contain a large number of stale, unused records. These old records should be removed at least every two weeks with the vacuum function in order to reduce disk usage and improve the speed of database queries. It is even more effective if you configure postgres to automatically vacuum the database without the need to stop the Data Center Network Manager (DCNM) services.
$INSTALLDIR/dcm/dcnm/bin/stopLANSANserver.bat
$INSTALLDIR/dcm/jboss-4.2.2.GA/server/dcnm/conf/database/postgresql.cfg.xml
$INSTALLDIR/dcm/Jboss-as-7.2.0.Final/standalone/conf/postgresql.cfg.xml
$INSTALLDIR/dcm/dcnm/bin/stopLANSANServer.sh
$INSTALLDIR/dcm/db/bin/psql -U <dbUsername> dcmdb
dcmdb=> VACUUM FULL ANALYZE VERBOSE;
Current limits are: 532000 page slots, 1000 relations, using 3182 kB.
VACUUM
dcmdb=>
dcmdb=> \q
$INSTALLDIR/dcm/dcnm/bin/startLANSANServer.sh
$INSTALLDIR/dcm/dcnm/bin/stopLANSANserver.sh
/etc/init.d/postgres-8.3 stop
#track_counts = on
#autovacuum = on
#log_autovacuum_min_duration = -1
#autovacuum_max_workers = 3
#autovacuum_naptime = 2min
#autovacuum_vacuum_threshold = 50
#autovacuum_analyze_threshold = 50
#autovacuum_vacuum_scale_factor = 0.2
#autovacuum_analyze_scale_factor = 0.1
#autovacuum_freeze_max_age = 200000000
#autovacuum_vacuum_cost_delay = 20
#autovacuum_vacuum_cost_limit = -1