{
  "slug": "failover-slot",
  "term": "Logical failover slot",
  "aliases": [
    "PostgreSQL failover slot"
  ],
  "definition": "A PostgreSQL logical failover slot is a logical replication slot enabled for synchronization to a physical standby so consumption can resume after promotion.",
  "note": "The failover flag enables synchronization; it does not prove a usable copy exists on the target standby. [pg-failover] The flag comes from the failover parameter of pg_create_logical_replication_slot or the failover option of CREATE SUBSCRIPTION, and a standby copies such slots only with sync_replication_slots enabled, which is off by default. [pg-decoding] [pg-config]\n\nSynchronization also needs a physical replication slot named in primary_slot_name on the standby, hot_standby_feedback enabled and a dbname in primary_conninfo. A slotsync worker then copies slots periodically, while pg_sync_replication_slots copies once without cyclic retries. A copy becomes persistent only if the standby still holds the WAL and catalog rows the primary slot needs. [pg-decoding]\n\nOn the primary, synchronized_standby_slots lists physical slots whose standbys must confirm WAL receipt before logical WAL senders pass decoded changes on, so a logical consumer cannot run ahead of its failover target. PostgreSQL 17, released on 2024-09-26, added the failover property, sync_replication_slots and synchronized_standby_slots. [pg-config] [pg-rel17]\n\nPostgreSQL 18 readiness requires a complete slot inventory and, for each listed slot, a standby row where synced is true, temporary is false and invalidation_reason is null. [pg-failover]",
  "status": "shipping",
  "advantages": [
    {
      "text": "Existing subscriptions can continue from the promoted standby instead of being recreated against it.",
      "citationIds": [
        "pg-failover"
      ]
    }
  ],
  "limitations": [
    {
      "text": "A temporary synchronized slot cannot support post-promotion continuation, and slot copying cannot restore WAL or catalog history already removed from the standby.",
      "citationIds": [
        "pg-decoding"
      ]
    },
    {
      "text": "Requesting an older LSN cannot rewind logical streaming before confirmed_flush_lsn; a reconnect alone does not establish that missing consumer history was replayed.",
      "citationIds": [
        "pg-logical-start"
      ]
    },
    {
      "text": "If a slot listed in synchronized_standby_slots is missing or invalidated, logical replication on the primary stops proceeding.",
      "citationIds": [
        "pg-config"
      ]
    },
    {
      "text": "Subscriptions left enabled during promotion can keep receiving data from a returning old primary until their connection strings change.",
      "citationIds": [
        "pg-decoding"
      ]
    }
  ],
  "related": [
    "replication-slot",
    "logical-decoding",
    "hot-standby-feedback",
    "replication-lag",
    "idempotency",
    "postgresql-timeline"
  ],
  "supersedes": [],
  "supersededBy": [],
  "firstSeen": null,
  "lastSeen": null,
  "updated": "2026-10-22",
  "citations": [
    {
      "id": "pg-failover",
      "title": "PostgreSQL 18: logical replication failover",
      "url": "https://www.postgresql.org/docs/18/logical-replication-failover.html",
      "accessed": "2026-10-22"
    },
    {
      "id": "pg-decoding",
      "title": "PostgreSQL 18: replication slot synchronization",
      "url": "https://www.postgresql.org/docs/18/logicaldecoding-explanation.html#LOGICALDECODING-REPLICATION-SLOTS-SYNCHRONIZATION",
      "accessed": "2026-10-22"
    },
    {
      "id": "hesela-replication",
      "title": "Hesela: Replication acknowledgements and logical failover readiness",
      "url": "https://hesela.com/analyses/replication-acknowledgements-durability-lag/",
      "accessed": "2026-10-16"
    },
    {
      "id": "pg-logical-start",
      "title": "PostgreSQL 18: START_REPLICATION SLOT LOGICAL and confirmed_flush_lsn",
      "url": "https://www.postgresql.org/docs/18/protocol-replication.html#PROTOCOL-REPLICATION-START-REPLICATION-SLOT-LOGICAL",
      "accessed": "2026-10-16"
    },
    {
      "id": "pg-config",
      "title": "PostgreSQL 18: replication settings, synchronized_standby_slots and sync_replication_slots",
      "url": "https://www.postgresql.org/docs/18/runtime-config-replication.html",
      "accessed": "2026-10-22"
    },
    {
      "id": "pg-rel17",
      "title": "PostgreSQL 17.0 release notes",
      "url": "https://www.postgresql.org/docs/release/17.0/",
      "accessed": "2026-10-22"
    }
  ],
  "provenance": [
    "pg-failover, pg-decoding and pg-config are PostgreSQL 18 documentation pages, read in full or in the slot synchronization and replication settings sections.",
    "pg-rel17 is the PostgreSQL 17.0 release notes, read in the replication items, and 17 and 2024-09-26 come from it.",
    "The off-by-default sync_replication_slots value comes from pg-config, and the readiness columns come from pg-failover."
  ]
}
