RDS Postgres free storage dropped from 400 GB to 5 GB over a weekend; table sizes didn't change.

AdvancedTroubleshootingDisk, memory and CPU
Answer

Likely causes → WAL is piling up because something is holding it. Most often an inactive logical replication slot (a CDC tool like Debezium or DMS that was stopped) prevents WAL from being recycled. Long-running transactions and temp files from huge sorts are other suspects.

Diagnose →

SELECT slot_name, active, pg_size_pretty(pg_wal_lsn_diff(pg_current_wal_lsn(), restart_lsn)) AS retained
FROM pg_replication_slots ORDER BY 3 DESC;
SELECT pid, now() - xact_start AS age, state, query FROM pg_stat_activity ORDER BY age DESC NULLS LAST LIMIT 5;

CloudWatch TransactionLogsDiskUsage and OldestReplicationSlotLag confirm it.

Fix → Restart the consumer if it's still needed; otherwise drop the slot: SELECT pg_drop_replication_slot('debezium_orders');. Enable storage autoscaling as a safety net while you clean up.

Prevent → Alert on replication slot lag and FreeStorageSpace, set max_slot_wal_keep_size so one dead slot can't fill the disk, and include "drop the slot" in the CDC decommission checklist.

All Real-World Interview questions Roadmap: Interview readiness

More on Disk, memory and CPU