DBAtlas · Database operations atlas

Promote a replica to primary

PostgreSQLReplication

Command

SELECT pg_promote(wait := true, wait_seconds := 60);

What it does

Takes the standby server out of recovery mode and turns it into a writable primary.

When to use it

To make the standby the new primary in a planned or emergency failover.

Caution

Promotion cannot be undone; the server can no longer follow the old primary. Make sure the old primary is really down to prevent split-brain. Alternative: pg_ctl promote.

Open in DBAtlas →

Related