I have a PostgreSQL 9.1 db running on Amazon EC2/EBS. The database has started to slow down. We have one table with 1m records that appears to be slowing everything down. When looking at the Postgres config we noticed the autovacuum setting was commented out.
What’s the right way to approach this problem? Should autovacuum be set to on? Should we have some cron that autovacuums on a set interval? How does one know if a database should be vacuumed?
psql: VACUUM VERBOSE ANALYZE the table. And read the output.Generally speaking – you want autovacuum on, and occasionally you might want to run VACUUM manually, if you’ll notice anything wrong.