CertGrid CertGrid
Troubleshooting·PostgreSQL

PostgreSQL Replication Slots and WAL Retention

A slot guarantees a standby can always catch up. The bill for that guarantee arrives on the primary's disk - here 30 MB held for a standby that was never coming back, and nothing raises an error while it grows.

Replication Guide 29 of 47 Advanced

Written against the versions above. `max_slot_wal_keep_size` caps how much a slot may retain and is unlimited by default. Setting it converts an unbounded disk risk into a broken replica, which is usually the better failure.

The 3 hosts these commands ran on: db-a01, db-b01, db-c01.
Server NameIP AddressOSRolesCPURAMHDD
db-a01192.168.0.81Ubuntu 26.04 LTSPrimary / Source / Replica Set Member 12 Core4 GB50 GB
db-b01192.168.0.82Ubuntu 26.04 LTSStandby / Replica / Replica Set Member 22 Core4 GB50 GB
db-c01192.168.0.83Ubuntu 26.04 LTSReplica Set Member 3 / Cascading and Delayed Replica2 Core4 GB50 GB

Before you start

  1. Stop a standby and watch the slot hold on

  2. Measure what an orphaned slot is costing

  3. Find and drop the orphan

  4. Confirm the surviving standby is unaffected

Official sources