PostgreSQL VACUUM stalls on partitioned table during heavy insert bursts; autovacuum appears idle
Environment
PostgreSQL 13 on Linux with a large partitioned table (range partitions by time). Insert workers perform high-concurrency inserts into the newest partition; autovacuum is enabled cluster-wide with default thresholds. Observed during nightly ingestion bursts.
Symptoms
VACUUM commands (manual and autovacuum) take extremely long or appear to spin without progress on certain partitions. I/O waits spike, CPU on bgwriter low, and long-running transactions appear in pg_stat_activity. Table bloat increases and queries slowed due to vacuum not reclaiming tuples.
Observations
pg_stat_activity shows several long-lived replica read queries and an ETL transaction that opened before the burst and never closed. pg_locks shows AccessShareLocks and some older transactions holding snapshots. Autovacuum workers are launched but show 'waiting' status and little IO. disk IO scheduler shows high queued writes to the partition device.
Already attempted
Tried manual VACUUM VERBOSE on affected partition — progress stalls. Increased maintenance_work_mem temporarily; set autovacuum_vacuum_scale_factor lower for that partition via ALTER TABLE. Considered pausing inserts but system needs near-real-time ingest.
Question
What are the most likely causes of autovacuum stalling under heavy insert bursts on partitioned tables, and what safe operational steps let me restore vacuum progress without long service interruptions?
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
- Databases32% match
PostgreSQL autovacuum ignores newly created partitions causing rapid bloat and slow queries on recent partitions
Open0 answers - Databases32% match
PostgreSQL autovacuum worker crashes with SIGSEGV on partitioned table after upgrade to 15.2
Open0 answers - Databases31% match
PostgreSQL bulk INSERT throughput collapses on partitioned table after stats collector restart
Open0 answers - Databases31% match
Autovacuum stalls and partition bloat due to lingering prepared transactions holding old snapshots in PostgreSQL 13
Open0 answers - Databases30% match
PostgreSQL 14: Rapid table bloat after nightly batch UPDATEs despite autovacuum enabled
Open0 answers