Parameter · Replication / Standby Servers
sync_replication_slots
Enables a physical standby to synchronize logical failover replication slots from the primary server.
- Default:
off - Type: bool
- Applies: Reload
In plain words
Logical replication slots used to exist only on the primary: after a failover, subscribers had nothing to continue from and had to be rebuilt. With sync_replication_slots = on (PostgreSQL 17+), a physical standby runs a slot sync worker that copies the primary's logical slots marked failover, so after promotion the subscribers can simply reconnect to the new primary.
For DBAs and operators
Requirements on the standby, checked by the worker:
hot_standby_feedback = onand a primary_slot_name (physical slot);dbname=…in primary_conninfo (used only to fetch slot info);wal_level = logical.
Otherwise: LOG: replication slot synchronization requires "hot_standby_feedback" to be enabled (and similar). Slots must be created with failover enabled: CREATE SUBSCRIPTION … WITH (failover = true) or pg_create_logical_replication_slot(…, failover => true). On the primary, list the standby's physical slot in synchronized_standby_slots, so subscribers never get ahead of it.
LOG: newly created replication slot "sub1" is sync-ready now
-- on the standby
SELECT slot_name, synced, temporary, failover, invalidation_reason
FROM pg_replication_slots;Synced slots cannot be used for decoding until promotion. After failover, point the subscription at the new primary with ALTER SUBSCRIPTION … CONNECTION. pg_sync_replication_slots() does a one-off sync manually.
How to change it
Change in postgresql.conf or ALTER SYSTEM, then run SELECT pg_reload_conf().
See it in context
Logical replication Replication slots Hot standby and recovery conflicts
Related parameters
synchronized_standby_slots hot_standby_feedback primary_slot_name primary_conninfo wal_level