Skip to content

autovacuum

Autovacuum keeps MVCC tables usable by scheduling background VACUUM and ANALYZE work. It is both a performance mechanism and a wraparound safety net, not optional cosmetic housekeeping.
Note

Fact — official short description: “Starts the autovacuum subprocess.”

Identity

Type , Valuebool
Upstream pg_settings type
Context , Valuesighup
Takes effect after configuration reload
Unit , Value
Raw unit
Range , Value
Raw limits in the last observed version
Enum values , Value
— for non-enum types
Category , ValueVacuuming / Automatic Vacuuming
Upstream classification
Latest boot value , Valueon
on

Lifecycle

Fact Value
First observed PG9.0 (research boundary)
Present in PG9.0–19 Beta 3
Removed in No
Introduction commit Not asserted: predates the PG9.0 research boundary
Commit date
Discussion

Default history

Measured PG9.0–19 Beta 3 boot defaults
Versions Raw boot_val Unit Human value
PG9.0–19 Beta 3 on on

How it works

When enabled, one launcher coordinates worker processes across databases. Workers use cumulative table-change statistics, so track_counts must also be enabled, and they run VACUUM or ANALYZE when a table crosses the relevant thresholds.

Ordinary vacuum triggers react to inserted, updated, and deleted tuples. Separately, PostgreSQL can launch anti-wraparound autovacuums even when this switch is off, because allowing old transaction IDs or multixact IDs to wrap would threaten correctness.

Most trigger and cost settings can be overridden per table through storage parameters. Temporary tables are outside autovacuum’s reach, and partitioned parent tables can still need manual ANALYZE even though their partitions are processed normally.

Tuning advice

Tip

Advice. These are workload-specific starting points and must be validated with measurements.

Workload Guidance
OLTP Keep it on. Tune busy tables individually, then watch dead tuples, autovacuum duration, canceled workers, and XID age before changing global aggressiveness.
OLAP Keep it on for safety, but coordinate it with bulk-load windows. Run explicit ANALYZE after large loads and on partitioned parents when planner statistics must be immediately current.
Small nodes Leave the default on. Reducing worker count or per-table aggressiveness is safer than disabling the launcher merely to save a small amount of background activity.

Pigsty

Values use the fixed 8-vCPU, 32-GiB, 100-GiB SSD fixture and render the current Pigsty templates for PG19 Beta 3; this does not assert current Pigsty support for that historical or beta release.

Template Effective value Versus upstream boot Source expression
OLTP Unmodified
OLAP Unmodified
CRIT Unmodified
TINY Unmodified
Caution

Advice — pending human review. Fact from the current Pigsty template projection: OLTP: PG9.0–19 Beta 3 unmodified; OLAP: PG9.0–19 Beta 3 unmodified; CRIT: PG9.0–19 Beta 3 unmodified; TINY: PG9.0–19 Beta 3 unmodified. No Pigsty-specific rationale is inferred from an absent override.

Common pitfalls

  • Turning it off does not disable emergency anti-wraparound vacuuming.
  • track_counts must be on for ordinary autovacuum decisions to work.
  • Long transactions and stale replication slots can prevent cleanup even when workers run successfully.
  • Autovacuum does not analyze partitioned parent tables solely because their partitions changed.
  • Temporary tables require maintenance from the owning session.

autovacuum_max_workers · autovacuum_naptime · autovacuum_vacuum_scale_factor · autovacuum_analyze_scale_factor · autovacuum_freeze_max_age · track_counts

References