PostgreSQL autovacuum ignores newly created partitions causing rapid bloat and slow queries on recent partitions
Environment
PostgreSQL 14.5 on Ubuntu 22.04 running on a single-primary VM with 32GB RAM. Table is range-partitioned by month with new partitions created via a background job. autovacuum is enabled with mostly-default settings; autovacuum_max_workers=3.
Symptoms
Queries that target the latest partitions (last 1-2 months) are becoming progressively slower over days. Disk usage for the table grows unexpectedly, and index bloat increases only on the newest partitions. Long-running SELECTs on the newest month incur many dead tuples.
Observations
pg_stat_all_tables shows autovacuum_count = 0 for the most recent partitions; last_autovacuum is NULL for several new partitions even after creation and heavy update/delete activity. Manually running VACUUM on a frozen partition reduces bloat and restores performance. There are no long-running transactions in pg_stat_activity at the times checked. autovacuum logs show normal activity for older partitions. The background job that creates partitions uses plain CREATE TABLE ... INHERITS or declarative partition CREATE TABLE FOR VALUES.
Already attempted
Forced VACUUM and ANALYZE on affected partitions (immediate improvement). Increased autovacuum_naptime and lowered autovacuum_vacuum_threshold on one partition manually then reverted (no long-term effect for other new partitions). Restarted PostgreSQL service and verified autovacuum launcher restarted (no change). Reviewed cron job that creates partitions — it sets default WITH (autovacuum_enabled = true) but uses table inheritance in one path and declarative partitions in another.
Question
Why is autovacuum not picking up the newly created partitions automatically? What diagnostics or configuration changes will ensure autovacuum recognizes and maintains new partitions without manual VACUUMs, and how to safely recover current bloat?
Verified community troubleshooting
No answers yet..
Incident analysis
Most likely causes
Summary
Suggested Fixes
Continue troubleshooting
Related troubles
Matched from the title, description and tags
- Databases39% match
PostgreSQL 14: Rapid table bloat after nightly batch UPDATEs despite autovacuum enabled
Open0 answers - Databases29% match
PostgreSQL prepared statements pick a generic plan after ANALYZE on a partitioned table, causing 10× slower execution
Open0 answers - Databases28% match
JDBC prepared statements on application server suddenly select a generic plan causing a 15× slowdown for partitioned table queries
Open0 answers - Databases25% match
PostgreSQL replica falls behind and reports WAL streaming delay when frequent autovacuum runs on primary
Open0 answers - Databases24% match
Logical backups hang waiting for locks when VACUUM FULL is running on large PostgreSQL tables
Open0 answers