CertGrid CertGrid
Troubleshooting·PostgreSQL

PostgreSQL Promotion and Timelines

`pg_promote()` turns a standby into a primary in seconds. It also increments the timeline, and that number is PostgreSQL recording that two histories have now diverged and cannot be recombined.

Replication Guide 30 of 47 Advanced

Written against the versions above. `pg_promote()` is a SQL function and needs no shell access, unlike `pg_ctl promote`. Both do the same thing.

The 2 hosts these commands ran on: db-a01, db-b01.
Server NameIP AddressOSRolesCPURAMHDD
db-a01192.168.0.81Ubuntu 26.04 LTSPrimary / Source / Replica Set Member 12 Core4 GB50 GB
db-b01192.168.0.82Ubuntu 26.04 LTSStandby / Replica / Replica Set Member 22 Core4 GB50 GB

Before you start

  1. Promote the standby

  2. Read the timelines and understand what just happened

Official sources