Parameter · Replication / Standby Servers
primary_slot_name
Sets the name of the replication slot to use on the sending server.
- Default:
'' (empty) - Type: string
- Applies: Reload
In plain words
If set, the standby streams through a named replication slot on the primary. The slot remembers how far this standby has got, and the primary keeps all WAL from that point on, even if the standby is offline for a while. That prevents "requested WAL segment has already been removed", at the risk of filling the primary's disk if the standby never comes back.
For DBAs and operators
Create the slot on the primary first: SELECT pg_create_physical_replication_slot('s1_slot'); (or pg_basebackup -C -S s1_slot -R). If it does not exist, the WAL receiver fails repeatedly with
FATAL: could not start WAL streaming: ERROR: replication slot "s1_slot" does not exist
Effective only with primary_conninfo set. Reloadable since PostgreSQL 13. With hot_standby_feedback, the slot also carries the standby's xmin. If no permanent slot is set, wal_receiver_create_temp_slot can create a temporary one.
Always pair slots with max_slot_wal_keep_size and monitor pg_replication_slots.active: a decommissioned standby's slot is the classic cause of a full pg_wal.
How to change it
Change in postgresql.conf or ALTER SYSTEM, then run SELECT pg_reload_conf().
See it in context
Related parameters
primary_conninfo max_replication_slots max_slot_wal_keep_size wal_receiver_create_temp_slot hot_standby_feedback