{
  "slug": "replication-slot",
  "term": "Replication slot",
  "aliases": [
    "PostgreSQL replication slot"
  ],
  "definition": "In PostgreSQL, a replication slot tracks a consumer's progress and retains WAL and other resources needed for that consumer to continue.",
  "note": "Physical and logical slots serve different replication streams. Retention can outlive a disconnected consumer and exhaust WAL storage; the slot is not a synchronous-commit policy. [pg-slots] PostgreSQL 18 applies max_slot_wal_keep_size at checkpoints; -1 permits unlimited slot retention, while a finite limit can sacrifice required history. [pg-slot-limits] The xmin and catalog_xmin horizons can hold back row-version cleanup independently of WAL byte headroom. [pg-slot-view]",
  "status": "shipping",
  "advantages": [],
  "limitations": [
    {
      "text": "A slot is not an independently stored backup and does not establish that a replica has applied a transaction; this is a distinction between retention and acknowledgement contracts.",
      "citationIds": [
        "pg-slots",
        "hesela-replication"
      ]
    },
    {
      "text": "Old slot horizons can contribute to transaction-ID exhaustion; PostgreSQL may refuse new XID-assigning work, and removing a still-needed slot can require rebuilding the replica.",
      "citationIds": [
        "pg-vacuum"
      ]
    }
  ],
  "related": [
    "asynchronous-replication",
    "synchronous-replication",
    "replication-lag",
    "logical-decoding",
    "write-ahead-log",
    "wal-archiving",
    "failover-slot",
    "hot-standby-feedback"
  ],
  "supersedes": [],
  "supersededBy": [],
  "firstSeen": null,
  "lastSeen": null,
  "updated": "2026-10-16",
  "citations": [
    {
      "id": "pg-slots",
      "title": "PostgreSQL 18: replication slots and WAL retention",
      "url": "https://www.postgresql.org/docs/18/warm-standby.html#STREAMING-REPLICATION-SLOTS",
      "accessed": "2026-10-16"
    },
    {
      "id": "pg-slot-limits",
      "title": "PostgreSQL 18: WAL retention limits and idle slot timeout",
      "url": "https://www.postgresql.org/docs/18/runtime-config-replication.html#GUC-MAX-SLOT-WAL-KEEP-SIZE",
      "accessed": "2026-10-16"
    },
    {
      "id": "hesela-replication",
      "title": "Hesela: Replication acknowledgements, retention and decoding",
      "url": "https://hesela.com/analyses/replication-acknowledgements-durability-lag/",
      "accessed": "2026-10-16"
    },
    {
      "id": "pg-slot-view",
      "title": "PostgreSQL 18: pg_replication_slots retention horizons",
      "url": "https://www.postgresql.org/docs/18/view-pg-replication-slots.html",
      "accessed": "2026-10-16"
    },
    {
      "id": "pg-vacuum",
      "title": "PostgreSQL 18: routine vacuuming and transaction-ID wraparound prevention",
      "url": "https://www.postgresql.org/docs/18/routine-vacuuming.html#VACUUM-FOR-WRAPAROUND",
      "accessed": "2026-10-16"
    }
  ]
}
