PG Failover Slots

Suggest edits

PG Failover Slots (pg_failover_slots) is an extension released as open source software under the PostgreSQL LICENSE. If you have logical replication publications on Postgres databases that are also part of a streaming replication architecture, PG Failover Slots avoids the need for you to reseed your logical replication tables when a new standby gets promoted to primary.

Since the replication slot used by logical replication is only maintained on the primary node, downstream subscribers don't receive any new changes from the newly promoted primary until the slot is created on the newly promoted primary. Picking up logical replication changes from the newly promoted standby is unsafe because the information that includes which data a subscriber has confirmed receiving and which log data still needs to be retained for the subscriber will have been lost, resulting in an unknown gap in data. PG Failover Slots makes logical replication slots usable across a physical failover using the following features:

  • Copies any missing replication slots from the primary to the standby
  • Removes any slots from the standby that aren't found on the primary
  • Periodically synchronizes the position of slots on the standby based on the primary
  • Ensures that selected standbys receive data before any of the logical slot walsenders can send data to consumers

Could this page be better? Report a problem or suggest an addition!