failover-slot · shipping · also PostgreSQL failover slot

Logical failover slot

A PostgreSQL logical failover slot is a logical replication slot enabled for synchronization to a physical standby so consumption can resume after promotion.

Related Observatory article: Read on hesela.com

The failover flag enables synchronization; it does not prove a usable copy exists on the target standby. [1] 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. [2] [5]

Synchronization 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. [2]

On 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. [5] [6]

PostgreSQL 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. [1]

Relations

related
Replication slot, Logical decoding, Hot standby feedback, Replication lag, Idempotency, PostgreSQL timeline

Advantages

  • Existing subscriptions can continue from the promoted standby instead of being recreated against it. [1]

Limitations

  • A temporary synchronized slot cannot support post-promotion continuation, and slot copying cannot restore WAL or catalog history already removed from the standby. [2]
  • Requesting an older LSN cannot rewind logical streaming before confirmed_flush_lsn; a reconnect alone does not establish that missing consumer history was replayed. [4]
  • If a slot listed in synchronized_standby_slots is missing or invalidated, logical replication on the primary stops proceeding. [5]
  • Subscriptions left enabled during promotion can keep receiving data from a returning old primary until their connection strings change. [2]

Citations

  1. PostgreSQL 18: logical replication failover (accessed 2026-10-22)
  2. PostgreSQL 18: replication slot synchronization (accessed 2026-10-22)
  3. PostgreSQL 18: START_REPLICATION SLOT LOGICAL and confirmed_flush_lsn (accessed 2026-10-16)
  4. PostgreSQL 18: replication settings, synchronized_standby_slots and sync_replication_slots (accessed 2026-10-22)
  5. PostgreSQL 17.0 release notes (accessed 2026-10-22)

Further reading

  1. Hesela: Replication acknowledgements and logical failover readiness (accessed 2026-10-16)
Sources & caveats
  • 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.

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

Published by Hesela team · Updated

Report a correction · Editorial standards · Reuse guidance

Cite this page
Hesela team. Logical failover slot. Hesela. 2026-10-22. https://hesela.dev/terms/failover-slot/