Autovacuum Is Not a Garbage Collector
The mental model most people have of VACUUM is that it reclaims space from deleted rows, like a garbage collector. That model is wrong in a way that causes real outages. VACUUM exists because PostgreSQL's MVCC keeps multiple row versions on disk, and old versions must be marked as removable before their space can be reused. It is about visibility, and space reclamation is a side effect.
Why the distinction matters operationally
If VACUUM is a garbage collector, then it is an optimization: it runs when convenient, and skipping it costs disk space. If VACUUM is a visibility mechanism, then it is mandatory: skipping it costs correctness, and the failure is transaction ID wraparound, which takes the database read-only until a full vacuum completes.
Wraparound is not theoretical. It happens on systems with long-running transactions, replication slots that nobody monitors, or autovacuum that has been effectively disabled by a per-table setting someone added to reduce I/O. The last case is the most common, and the least understood.
The settings that actually matter
Scaling autovacuum workers is usually the wrong fix. What matters more:
autovacuum_vacuum_scale_factorper large table, lowered dramaticallyautovacuum_vacuum_cost_limitraised so each worker does more per wakeup- Monitoring
pg_stat_user_tables.n_dead_tupand age, not just disk usage - Replication slots: check
pg_replication_slotsfor inactive slots holding back xmin
A replication slot with a stale xmin is a slow-motion wraparound. It prevents vacuum from removing any row version newer than the slot's position. If the slot belongs to a replica that has been down for a week, you are accumulating dead tuples across the entire cluster.
The one query to run weekly
Query the maximum transaction ID age across all databases and alert well before it approaches two billion. The cost of the query is zero. The cost of discovering wraparound during a busy Tuesday is not.