How can I perform the vacuum using the 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.

Upvotes: 21

Views: 39665

Answers (2)

Ken Downs
Ken Downs

Reputation: 4827

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: https://www.postgresql.org/docs/current/maintenance.html

Upvotes: 23

Frank Wiles
Frank Wiles

Reputation: 1608

If you're running a recent version of PostgreSQL you likely have auto-vacuum running so the benefits of running VACUUM manually may be very minimal.

Upvotes: 8

Related Questions