PostgreSQL Replication
A practical guide to PostgreSQL replication slots, WAL retention safety, and the monitoring needed to avoid storage incidents.
A mechanism that retains WAL required by a subscriber or backup stream to prevent premature recycling.
Replication slots prevent required WAL from being removed before a consumer has processed it.
They protect replication and CDC pipelines from missing history and are critical when consumers can temporarily lag.
Physical slots are commonly used with standbys; logical slots are used by logical replication and CDC consumers.
Both protect continuity, but both can retain WAL indefinitely if consumers stop advancing.
Inactive or stuck slots can retain WAL indefinitely, driving disk growth and potential outages.
Set ownership, alerting, and cleanup policy for slots. Replication slots are safe when actively governed, risky when ignored.