A PostgreSQL replication timeline records a WAL history branch created when a standby is promoted or recovery diverges. Promotion makes the new primary's subsequent WAL incompatible with the old timeline after the split. section 9.6 section 9.2
The lagging-standby promotion trap
Suppose a failed primary has two replicas, but one is behind. If automation promotes the lagging replica, the other replica contains WAL that the new primary lacks. Recovering those transactions and reintegrating them is complicated; the replicas must rewind to before the timeline split before following the new primary. section 9.6
Use timelines to reason about recovery and failover:
- Treat promotion as a branch in WAL history, not merely a role change. section 9.6
- Combine full physical backups with archived WAL when using point-in-time recovery; a base backup alone is insufficient. section 9.2
- Avoid improvised failover logic that ignores lag or network partitions, because it can produce incompatible histories or split-brain primaries. section 9.6
