P50 28s Analyze →
↩ All field notes
Querk · Field notes

Autovacuum Tuning for the SMB: A Field Guide

Published November 25, 2026 · Querk — Postgres review pipeline

Autovacuum is PostgreSQL’s built-in garbage collector, and for most small and mid-sized databases, its default settings are more than adequate. The temptation to tune every table manually usually creates more operational overhead than it solves. Tune three categories of tables explicitly, and leave everything else on defaults.

Why Defaults Usually Suffice

PostgreSQL ships with autovacuum enabled and configured to trigger based on the proportion of dead tuples in a table. For typical SMB workloads—CRUD applications, content management systems, internal dashboards—those defaults handle bloat without intervention. Aggressive manual tuning can starve I/O, increase lock contention, and mask schema problems that should be fixed instead. Unless a table shows measurable bloat or transaction ID wraparound risk, leaving autovacuum alone is the safer choice.

The Three Tables Worth Manual Tuning

Not all tables behave the same. Manual tuning is justified when a table’s churn rate, size, or index count breaks the assumptions behind the defaults.

High-volume transactional tables, such as order lines or event logs, generate dead tuples faster than defaults can keep up. Lowering `autovacuum_vacuum_scale_factor` ensures vacuum runs more frequently before bloat degrades sequential scans.

Large tables with concentrated update patterns, like user profiles or inventory records, often see the same rows updated repeatedly. Default thresholds may wait too long between vacuum cycles, allowing dead tuples to accumulate on hot pages. A lower threshold triggers vacuum sooner.

Tables with many indexes and heavy delete workloads, such as audit trails or temporary job queues, suffer from index bloat as well as table bloat. More frequent vacuuming, sometimes paired with a lower `fillfactor`, helps keep index scans efficient.

Parameters That Actually Matter

When tuning is warranted, only a handful of parameters deserve attention. `autovacuum_vacuum_scale_factor` controls the fraction of dead tuples that triggers a vacuum; reducing it from the default 0.2 makes vacuum run earlier on large tables. `autovacuum_vacuum_threshold` sets the minimum dead-tuple count before vacuum considers the table. For insert-only workloads on PostgreSQL 13 and later, `autovacuum_vacuum_insert_scale_factor` addresses wraparound risk from pure inserts. Adjusting `autovacuum_vacuum_cost_limit` can throttle vacuum I/O if it interferes with production traffic.

Monitor Before You Tune

Manual changes should follow observation, not assumption. Querying `pg_stat_user_tables` reveals dead tuple counts and last vacuum timestamps, while `pg_stat_progress_vacuum` shows whether a vacuum is actively running. Comparing bloat metrics before and after confirms whether tuning helped. Querk can surface these vacuum statistics alongside query performance, making it easier to identify which tables need custom settings.

The bottom line for SMB teams is restraint. Tune high-churn, large-update, and index-heavy tables individually, keep the rest on PostgreSQL defaults, and let monitoring dictate when a parameter change is justified.

Paste your slowest query — 3 free reviews, no signup. Index DDL, rewrites, write-path impact, and a verification command back in ~30 seconds. Analyze a query →