Cookbook recipe

Tame autovacuum on a high-churn table

Applies to PostgreSQL 13–17 Last reviewed May 2026 Grounded in source
Estimated investigation4 min

Scenario

One hot table churns constantly and bloats faster than the global autovacuum settings can keep up. Per-table tuning fixes it without touching the whole cluster. Diagnose it Check dead tuples and last autovacuum: SELECT relname, n_dead_tup,…

Investigation Path

One hot table churns constantly and bloats faster than the global autovacuum settings can keep up. Per-table tuning fixes it without touching the whole cluster.

Diagnose it

Check dead tuples and last autovacuum:

SELECT relname, n_dead_tup, n_live_tup, last_autovacuum
FROM pg_stat_user_tables
ORDER BY n_dead_tup DESC LIMIT 10;

Why it happens

Autovacuum triggers at autovacuum_vacuum_threshold + scale_factor * n_live_tup. On a big, hot table the scale factor makes the threshold huge, so vacuum runs too rarely and bloat accumulates.

This is a Pro lesson

Get every Learning Pathway and cookbook recipe — grounded in PostgreSQL source code, with diagnostics, fixes, and prevention for each topic.

Continue this lesson to learn:

  • How to fix it
  • Prevent it next time
  • Related & next steps
  • All 36 Learning Pathway lessons
  • 170+ cookbook recipes
  • Source-grounded diagnostics & fixes

Secure checkout Cancel anytime Source-grounded

Career Impact

This scenario builds production judgment and operational confidence under pressure.

Open Career Dashboard →

Keep going

Related & next steps

Was this helpful?

← All cookbook recipes