PostgreSQL 14: Rapid table bloat after nightly batch UPDATEs despite autovacuum enabled
Environment
Ubuntu 20.04 LTS, PostgreSQL 14.5 installed from PGDG repository on a bare-metal server (8 cores, 32 GB RAM, 2 x 2 TB NVMe, ext4). Single database with a monthly-partitioned table ~120M rows; autovacuum left at package defaults.
Symptoms
After nightly batch UPDATE that touches ~10% of the partitioned table, total database disk usage increases by ~25–40 GB overnight. User SELECTs on the updated partitions slow down (higher latency) and free space on the filesystem does not return. Autovacuum appears to run but does not reclaim the newly created dead tuples.
Observations
pg_stat_user_tables shows high n_dead_tup on affected partitions; pgstattuple reports ~30–45% bloat on those partitions. autovacuum logs show multiple autovacuum worker runs with no significant reduction in dead tuples. No long-running normal transactions visible in pg_stat_activity. No prepared transactions reported. Replication is streaming synchronous to one standby with replication_slot present, slot not listed as inactive. Manual VACUUM FULL on a partition reclaims space but requires exclusive locks and disrupts services.
Already attempted
Restarted PostgreSQL service (short maintenance window) — no effect on bloat. Ran manual VACUUM (non-FULL) which improved visibility but did not fully reclaim space. Increased autovacuum_vacuum_cost_delay and autovacuum_vacuum_scale_factor on a test instance (no production change). Verified no open prepared transactions and checked pg_replication_slots for long-held slots. Took a physical backup before trying VACUUM FULL on one partition.
Question
What is the most likely root cause of the rapid bloat despite autovacuum being active, and what safe, reversible remediation steps will reclaim space and prevent recurrence without prolonged downtime?
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
- Databases28% match
PostgreSQL autovacuum ignores newly created partitions causing rapid bloat and slow queries on recent partitions
Open0 answers - Databases22% match
Autovacuum worker SIGSEGV after PostgreSQL 13→14 upgrade when extension is loaded via shared_preload_libraries
Open0 answers - Databases21% match
PostgreSQL bulk INSERT throughput collapses on partitioned table after stats collector restart
Open0 answers - Databases21% match
Logical backups hang waiting for locks when VACUUM FULL is running on large PostgreSQL tables
Open0 answers - Databases21% match
PostgreSQL logical replication slot grows until disk full after subscriber disconnects during nightly load
Open0 answers