DB Internals AtlasPostgreSQL 18.6 Home About

Parameter · Vacuuming / Automatic Vacuuming

autovacuum_vacuum_max_threshold

Maximum number of tuple updates or deletes prior to vacuum. -1 disables the maximum threshold.

  • Default: 100000000
  • Type: integer
  • Range: -1 … 2147483647
  • Applies: Reload

In plain words

New in PostgreSQL 18. However big a table is, autovacuum will vacuum it once it has this many dead rows (default 100 million). Without the cap, 20% of a 5-billion-row table would be a billion dead rows.

For DBAs and operators

Applied after the usual sum: vacthresh = min(autovacuum_vacuum_threshold + autovacuum_vacuum_scale_factor × reltuples, autovacuum_vacuum_max_threshold). -1 disables the cap (pre-18 behaviour). It does not affect insert-triggered or analyze thresholds.

The cap only kicks in for tables above roughly 500 million rows with the default scale factor. It is a safety net, not a replacement for per-table tuning: 100M dead tuples is still many GB of bloat and a long vacuum. Lower it per table where needed:

ALTER TABLE events SET (autovacuum_vacuum_max_threshold = 5000000);

How to change it

Change in postgresql.conf or ALTER SYSTEM, then run SELECT pg_reload_conf().

See it in context

Autovacuum: when tables get vacuumed

Related parameters

autovacuum_vacuum_scale_factor autovacuum_vacuum_threshold

All Vacuuming parameters