Parameter · Vacuuming / Automatic Vacuuming
autovacuum_vacuum_threshold
Minimum number of tuple updates or deletes prior to vacuum.
- Default:
50 - Type: integer
- Range: 0 … 2147483647
- Applies: Reload
In plain words
Autovacuum vacuums a table when its dead rows exceed threshold + scale factor × rows. This is the fixed part. It matters mostly for small tables, where 20% of the rows is only a handful.
For DBAs and operators
The full PostgreSQL 18 rule for update/delete-triggered vacuum is:
vacthresh = autovacuum_vacuum_threshold
+ autovacuum_vacuum_scale_factor * reltuples
vacthresh = min(vacthresh, autovacuum_vacuum_max_threshold) -- unless -1
vacuum if n_dead_tup > vacthreshreltuples comes from pg_class (estimated by the last VACUUM/ANALYZE; -1, treated as 0, if never analyzed). n_dead_tup is the cumulative-statistics counter in pg_stat_user_tables; statistics are reset after a crash or pg_stat_reset(), which makes autovacuum "forget" pending work.
Per-table overrides
-- tiny but very hot queue table: vacuum after ~1000 dead rows regardless of size
ALTER TABLE job_queue SET (autovacuum_vacuum_threshold = 1000,
autovacuum_vacuum_scale_factor = 0);Using a large threshold with scale factor 0 gives "vacuum every N changes" behaviour, handy for append-mostly tables with periodic deletes. Toast tables have their own toast.autovacuum_vacuum_threshold.
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 VACUUM Life of a DELETE
Related parameters
autovacuum_vacuum_scale_factor autovacuum_vacuum_max_threshold autovacuum_analyze_threshold autovacuum_naptime