Data Monitoring / PostgreSQL Monitoring
PostgreSQL: Replication slot WAL retention
Disk usage grows because a replication consumer stops progressing. Inspect slot activity, retained WAL distance and consumer recovery needs.
Environment and inputs: PostgreSQL 18 documentation baseline; views, extensions and permissions vary across versions and managed services.
Failure scenario
Disk usage grows because a replication consumer stops progressing. Confirm the cause before choosing a fix.
Evidence to collect
Inspect slot activity, retained WAL distance and consumer recovery needs. Record the time, affected scope and a healthy comparison interval.
Worked diagnostic example
Read-only PostgreSQL slot inventory; do not remove a slot merely because it is currently inactive.
SELECT slot_name, slot_type, active, restart_lsn, confirmed_flush_lsn
FROM pg_replication_slots;
Fix the confirmed cause
Restore consumer progress or retire an approved unused slot without discarding required replication history casually. Write the expected result first. Change one relevant setting at a time.
Check the result and hand over
Repeat the check for replication slot wal retention using the same scope and a representative interval. Check that the symptom is resolved, expected records are present and downstream results are correct. If coverage, correctness or latency worsens, restore the recorded configuration through the agreed rollback process.
Scope and precautions
Prefer read-only access and limit queries to the relevant period or dataset. This example has not been tested on your systems. Test changes in an approved environment. Keep credentials and sensitive data out of shared evidence.