slots: replication slots and retention
List replication slots, active PIDs, retained WAL bytes, xmin/catalog_xmin blockers, and inactive slot warnings.
Reads sys_replication_slots and computes retained WAL from the current insert LSN (primary) or replay LSN (standby). Read-only: never drops or modifies replication slots.
Usage
Key Options
| Option | Effect |
|---|---|
--json | Emit structured JSON (slot.list including xmin, catalog_xmin, restart_lsn, retained_wal_bytes) |
Verdict & Reading Output
WARN(exit=1):slot.inactivewhen a replication slot isactive = false. Output highlights retained WAL plus anyxmin(vacuum horizon) orcatalog_xmin(logical catalog horizon) held back, sorted with inactive horizon blockers first.OK(exit=0): No inactive slots (or no slots configured).UNKNOWN(exit=3): Probe failure or timeout. Whenslot.listsucceeds, a non-NULLrestart_lsnwith a missing LSN diff still displaysretained WAL unknown(andactive = falsetriggersWARN).
Example (KES V9 Primary, COLUMNS=80)
Related Commands
kbdiag wal— see WAL directory size alongside slot and archive retentionkbdiag repl— check streaming replicas and standby receiver/replay statuskbdiag vacuum/kbdiag txn— investigate dead tuples or long-running transactions holdingxmin