Parameter · Write-Ahead Log / Recovery Target
recovery_target_timeline
Specifies the timeline to recover into.
- Default:
latest - Type: string
- Applies: Restart required
In plain words
Every time a standby is promoted or a PITR finishes, WAL history forks into a new "timeline", like a branch. During recovery PostgreSQL must choose which branch to follow. The default latest follows the newest one found in the archive, which is what standbys need after a failover.
For DBAs and operators
Timeline IDs are the first 8 hex digits of WAL file names (00000002…). Each new timeline writes <TLI>.history, listing the parent timelines and fork LSNs. Values:
- latest (default since PostgreSQL 12): follow forks to the newest timeline in the archive/stream.
- current: stay on the timeline the base backup was taken on.
- a number (decimal, or hex with
0x, e.g.0x11): follow history to that timeline.
Errors to know: FATAL: requested timeline 3 is not a child of this server's history means the backup's starting checkpoint lies after the point where the requested timeline forked off (the DETAIL shows both LSNs), so that timeline cannot be reached from this backup. When re-running a PITR that itself came from a PITR, specify the timeline explicitly. On promotion: LOG: selected new timeline ID: 4
How to change it
Change in postgresql.conf or ALTER SYSTEM, then restart the server.
See it in context
Archiving and point-in-time recovery Streaming replication Startup process