Add autovacuum configuration audit to database diagnostics

What & why

Adds an Autovacuum configuration section to the admin Database Diagnostics page (/admin/database_diagnostics), complementing the vacuum-activity section. Per database (currently main) it surfaces:

  • Effective settings — autovacuum-related GUCs from pg_settings. Foldable, collapsed by default, with a status icon (green tick when all healthy) and badges flagging risky values: autovacuum off, cost_delay = 0, low max_workers, cost limit at/near the default, and work_mem = -1.

Severity thresholds live in frontend constants so they are easy to adjust.

Per-table overrides and the scale-factor cross-reference now live in a follow-up MR: !245561 (merged) (targets this branch, merge after this one).

Database review

All reads target the main database and run on-demand when an admin opens the page. The one new catalog query and its EXPLAIN (ANALYZE, BUFFERS) plan (captured against a local GDK with ~16.9k relations) is below.

Effective settings — AUTOVACUUM_SETTINGS_SQL

SELECT name, setting, unit
FROM pg_settings
WHERE name IN ('autovacuum', 'autovacuum_max_workers', ... 16 names ...)
EXPLAIN (ANALYZE, BUFFERS) — Execution Time: 0.458 ms
Sort  (cost=17.57..17.77 rows=80 width=96) (actual time=0.434..0.434 rows=16 loops=1)
  Sort Key: a.name
  Sort Method: quicksort  Memory: 25kB
  Buffers: shared hit=3
  ->  Function Scan on pg_show_all_settings a  (cost=0.04..15.04 rows=80 width=96) (actual time=0.396..0.419 rows=16 loops=1)
        Filter: (name = ANY ('{autovacuum,...}'::text[]))
        Rows Removed by Filter: 362
Planning Time: 0.073 ms
Execution Time: 0.458 ms

The two queries covered by the earlier EXPLAIN plans in this description (AUTOVACUUM_OVERRIDES_SQL, LARGEST_TABLES_SQL) moved to !245561 (merged) along with the code that uses them; see that MR's description for their plans.

Screenshots

Current state (2026-08-19). Per-table overrides / scale-factor sections moved to !245561 (merged).

Expanded — autovacuum_vacuum_cost_limit shows the resolved value next to the -1 sentinel:

autovacuum-settings-expanded

Collapsed (default):

autovacuum-settings-collapsed

References

Edited by Niko Belokolodov

Merge request reports

Loading
Loading