Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I perform the vacuum using the PostgreSQL?

Tags:

sql

postgresql

I need to vacuum the PostgreSQL database in production server. I am very new to do this. So anybody knows the PostgreSQL steps, please guide me.

I think it's very useful to improve the performance of PostgreSQL in production server.

like image 223
Adalarasan Sachithanantham Avatar asked Jan 21 '11 13:01

Adalarasan Sachithanantham


1 Answers

Connect to the database and issue this command: "VACUUM". This causes a run in "lazy mode" that can be used during normal production use. It is recommended you actually invoke it as "vacuum analyze" which will also update statistics.

If you want to see lots of detail, you can at the console type "vacuum verbose"

The more extreme form is "vacuum full" which causes heavy table locking and cannot really be used on a production system.

Source: http://www.postgresql.org/docs/8.1/static/maintenance.html

like image 122
Ken Downs Avatar answered Oct 20 '22 00:10

Ken Downs