All Products
Search
Document Center

PolarDB:Logical replication slot failover

Last Updated:Mar 28, 2026

By default, PostgreSQL's streaming replication protocol does not sync logical replication slots from the primary node to the standby node. If a failover occurs, the slot is lost and all logical subscriptions are disrupted. PolarDB for PostgreSQL resolves this by syncing logical replication slots to the standby node so that subscriptions continue seamlessly after a failover.

Note

Physical replication slot failover is not supported. For background on how replication slots work, see Replication slots in the PostgreSQL documentation.

Enable or disable logical replication slot failover

Control logical replication slot failover by setting the polar_failover_slot_mode parameter. Configure the parameter in the console.

Choose a mode

ModeBehaviorData safetyUse when
async (default)Syncs slots asynchronously. No data loss during HA cluster failover. The logical replication client may receive duplicate data after failover. If the client has newer data than the new primary after failover, it may have retained data that was lost during failover.No loss during HA failover; possible duplicatesMost workloads; duplicate data is acceptable
syncSyncs slots synchronously. Ensures the logical replication client never receives changes ahead of the standby node. No data loss during failover.No loss during failover; see edge case belowData consistency is critical
offDisables logical replication slot failover.Not applicableFailover for logical replication is not needed
Important

In sync mode, an edge case exists: if the standby node disconnects for an extended period or is being rebuilt, the primary-standby sync latency can grow large enough that the logical replication client receives changes ahead of the standby. If a failover occurs in this window, data may be lost in logical replication, and data generated on the new primary may also be lost. To prevent this, contact support to set polar_priority_replication_force_wait to on. This prevents the primary from sending changes to the logical replication client until the standby reconnects or finishes rebuilding. Note that this reduces the availability of logical replication during disconnection periods.

Note

If duplicate data from async mode affects your workload, switch to sync mode.

Limitations

  • Physical replication slot failover is not supported.

What's next