Postgresql – Postgres: Vacuum taking too long

amazon-rdspostgresql

I have a database currently sitting on ~6B live tuples, ~4B dead tuples.

I've ran the VACUUM command for 3 days now, and then suddenly my internet died. Meaning i lost all progress. How can i speed up the VACUUM speed? It's currently running on AWS RDS.

Is there a way to run command in background, e.g. disconnect/turn off PC?

Btw running on 9.3

Best Answer

You may want to turn on AUTO VACUUM? AWS Docs suggests that as a best practice

Set the autovacuum and once it is done, you can turn it off if you wish.

If you want to really run it in a terminal and then disconnect, refer to this answer: How to execute a query from psql without waiting for the result?