Thursday, March 22, 2012

Using Vacuumdb in PostgreSQL

I read in the PostgreSQL docs that vacuumdb or vacuum should be used on the databases every day. I have been running it manually the last couple of days and it has made a difference on query response times. I highly recommend using it.

To vacuum one database from the command line.


vacuumdb -d MyDB -v  -z -U postgres 




To vacuum one database from the command line.



vacuumdb -a -v  -z -U postgres 



-d = database name
-v = verbose output
-z = analyze
-U = username
-a = vacuum all databases