PostgreSQL

Excessive WAL file accumulation fills disk when replication lags or archiving fails

critical
storageUpdated Jan 25, 2026
Technologies:
How to detect:

WAL directory grows excessively when many WAL files accumulate due to replication lag or archive process failures. Without limits, WAL files can fill the disk entirely.

Recommended action:

Check WAL directory size with `du -sh /var/lib/postgresql/14/main/pg_wal/` and count files with `ls /var/lib/postgresql/14/main/pg_wal/ | wc -l`. Investigate replication lag or archive issues. Set `max_wal_size = 2GB` and `min_wal_size = 1GB` to limit retention. Reduce checkpoint timeout with `checkpoint_timeout = 10min` for more frequent checkpoints. For non-replicated servers, set `wal_keep_size = 1GB` (PostgreSQL 13+) or `wal_keep_segments = 64` (PostgreSQL 12).