replication-slot · shipping · also PostgreSQL replication slot

Replication slot

A replication slot is a server-side record of a consumer's replication progress that retains log segments and other resources the consumer still needs.

Related Observatory article: Read on hesela.com

Physical and logical slots serve different replication streams. A slot keeps log segments until the standby has received them, and keeps rows that could cause a recovery conflict, even while the standby is disconnected. Retention can therefore outlive a dead consumer and exhaust log storage, and a slot is not a synchronous-commit policy. [1] Slots need a log level of replica or higher, and the default limit is 10 slots per server. [2]

A retention cap is applied at checkpoints, and its default of -1 permits unlimited slot retention. As a slot falls behind, its status can move from reserved or extended to unreserved, and then to lost, after which it is unusable. [2] [4] The xmin and catalog_xmin horizons can hold back row-version cleanup independently of log byte headroom. [4]

An idle timeout, disabled at its default of 0, invalidates slots inactive for longer than the set duration, but only at the next checkpoint, so invalidation can lag the threshold. It does not apply to slots that reserve no log or to standby slots synced from a primary. [2] Slots hold back transaction ID cleanup but do not directly hold back multixact cleanup. [5]

Relations

related
Asynchronous replication, Synchronous replication, Replication lag, Logical decoding, Write-ahead log, WAL archiving, Logical failover slot, Hot standby feedback, Point-in-time recovery

Advantages

  • A slot retains only the segments known to be needed, whereas a fixed minimum keep size or an archive often retains more. [1]

Limitations

  • Retention tracks what a consumer still needs, so a slot is neither an independent backup nor evidence that a replica has applied a transaction. [1]
  • Old slot horizons can drive transaction ID exhaustion: the server refuses new IDs with fewer than three million left, and dropping a slot that a replica still uses can require rebuilding that replica. [5]

Citations

  1. PostgreSQL 18: replication slots and WAL retention (accessed 2026-10-23)
  2. PostgreSQL 18: slot limits, WAL retention cap and idle slot timeout (accessed 2026-10-23)
  3. PostgreSQL 18: pg_replication_slots status values and retention horizons (accessed 2026-10-23)
  4. PostgreSQL 18: routine vacuuming and transaction-ID wraparound prevention (accessed 2026-10-23)

Further reading

  1. Hesela: Replication acknowledgements, retention and decoding (accessed 2026-10-16)
Sources & caveats
  • pg-slots re-read 2026-10-23 for segment and row retention, disconnected standbys and the comparison with fixed keep sizes and archives.
  • pg-slot-limits re-read 2026-10-23 for the default of 10 slots, the -1 retention default and the idle timeout invalidated at checkpoints.
  • pg-slot-view re-read 2026-10-23 for the reserved, extended, unreserved and lost status values and the xmin horizons.
  • pg-vacuum re-read 2026-10-23 for the three-million-ID refusal threshold, dropping stale slots and the multixact exception.
  • The point-in-time-recovery entry links here because archived log segments are the alternative retention path to slots, and slot retention is bounded by what recovery still needs.
  • A companion analysis on replication acknowledgements is listed but not used in prose.

JSON: /data/terms/replication-slot.json

Published by Hesela team · Updated

Report a correction · Editorial standards · Reuse guidance

Cite this page
Hesela team. Replication slot. Hesela. 2026-10-23. https://hesela.dev/terms/replication-slot/