IT lexicon › Database › Autovacuum

Autovacuum

Database På svenska → Updated: 2026-05-28

A PostgreSQL background process that automatically runs VACUUM and ANALYZE when a table has accumulated enough dead rows. On by default. A misconfigured autovacuum is one of the most common Postgres performance traps.

The trigger: it runs when dead rows exceed autovacuum_vacuum_threshold + scale_factor × table size. The default scale_factor (0.2 = 20%) is often too lazy for large tables → they bloat a lot before vacuum kicks in. Tuning: lower the scale_factor per table for hot tables, increase the number of workers, raise autovacuum_vacuum_cost_limit so it can keep up. Symptoms of trouble: growing bloat, "wraparound" warnings, sudden performance dips. Anti-pattern: turning off autovacuum "for performance" → sooner or later leads to catastrophe. Monitor last_autovacuum in pg_stat_user_tables.

← Back to the lexicon