pgconfigurator
pgconfigurator

max_slot_wal_keep_size

No restart — takes effect on reloadPostgreSQL 13+disk size (MB/GB); -1 unlimited

Bounds how much WAL one replication slot may hold — guards against a dead consumer filling the disk.

What it does

Normally a replication slot retains WAL until the consumer confirms it — useful, but dangerous if the consumer disappears. max_slot_wal_keep_size puts a ceiling on that retention: once a slot would need more, PostgreSQL invalidates it instead of letting WAL grow without bound.

How to tune it

Set a sensible cap (often several GB) to keep an orphaned slot from filling the disk. The trade-off: an invalidated slot means that standby has to rebuild from a fresh base backup. Pair with monitoring of pg_replication_slots so you notice the problem before invalidation.

Related parameters