PostgreSQL

WAL directory bloats to terabytes when replication consumers never reconnect

critical
storageUpdated Mar 4, 2026
Technologies:
How to detect:

PostgreSQL data directory accumulates WAL files consuming the majority of disk space - cluster consumes nearly 1.06 TB while active databases use only ~70 GB. WAL files are retained indefinitely waiting for replication slot consumers that will never return, causing 900+ GB of wasted storage.

Recommended action:

Investigate data directory disk usage with 'du -sh /var/lib/postgresql/*/pg_wal' to identify WAL bloat. Query pg_replication_slots to find inactive slots. Remove orphaned slots immediately. After removal, monitor for immediate disk space recovery - WAL files should be purged within minutes, reclaiming hundreds of GB. Set up monitoring on replication_slot_restart_delay_bytes and replication_slot_safe_wal_size to detect future slot issues before disk fills.