DB Internals AtlasPostgreSQL 18.6 Home About

Parameter · Vacuuming / Automatic Vacuuming

autovacuum_analyze_threshold

Minimum number of tuple inserts, updates, or deletes prior to analyze.

  • Default: 50
  • Type: integer
  • Range: 0 … 2147483647
  • Applies: Reload

In plain words

The planner relies on statistics about each table. Autovacuum re-runs ANALYZE when threshold + 10% of the rows have been inserted, updated or deleted since the last analyze. This is the fixed part.

For DBAs and operators

anl_thresh = autovacuum_analyze_threshold + autovacuum_analyze_scale_factor * reltuples
analyze if n_mod_since_analyze > anl_thresh

Unlike vacuum, there is no max cap. Gotchas:

  • Partitioned tables (the parent) are never analyzed by autovacuum; only their leaf partitions are. Run ANALYZE parent yourself (e.g. after big loads) or queries on the parent get poor estimates.
  • Temporary tables are not seen by autovacuum at all.
  • After pg_upgrade statistics are kept since PostgreSQL 18, but extended statistics still need ANALYZE; after a crash the counters reset.
ALTER TABLE orders SET (autovacuum_analyze_threshold = 10000,
                        autovacuum_analyze_scale_factor = 0);

How to change it

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

See it in context

ANALYZE and statistics Autovacuum: when tables get vacuumed

Related parameters

autovacuum_analyze_scale_factor autovacuum_vacuum_threshold default_statistics_target

All Vacuuming parameters