select open change scope Open full search

PG.CENTER connects PostgreSQL documentation, reference, and ecosystem knowledge. Maintained by Pigsty.

CONFIGURATION / WRITE-AHEAD LOG

recovery_target_timeline

Read PG 18 manual ↗

Specifies recovering into a particular timeline.

Type
string
Context
postmaster
Measured default
latest
Unit
Metadata snapshot
18

Definition PG 18 manual

Specifies recovering into a particular timeline. The value can be a numeric timeline ID or a special value. The value current recovers along the same timeline that was current when the base backup was taken. The value latest recovers to the latest timeline found in the archive, which is useful in a standby server. latest is the default.

To specify a timeline ID in hexadecimal (for example, if extracted from a WAL file name or history file), prefix it with a 0x. For instance, if the WAL file name is 00000011000000A10000004F, then the timeline ID is 0x11 (or 17 decimal).

You usually only need to set this parameter in complex re-recovery situations, where you need to return to a state that itself was reached after a point-in-time recovery. See Section 25.3.6 for discussion.

Measured default history
Version intervalDefault
12 – 19latest
Analysis & operational context

Authored guidance from the GUC source snapshot; the version-specific manual above is the definition reference. View source ↗

How it works

Specifies the timeline history that recovery follows. The value is read at server start for the recovery run.

latest follows the newest timeline found in the archive, current stays on the timeline current when the base backup was taken, and an explicit decimal or 0x-prefixed hexadecimal ID selects a particular branch. A timeline can be selected with or without an earlier stopping target.

The chosen timeline must descend from the base backup and its history/WAL files must be available. This setting selects a branch; it does not itself choose a transaction boundary or promote the server.

Operational considerations

Using latest when a deliberate re-recovery must stay on an older branch.

Using current when the required WAL exists only on a descendant timeline.

Selecting a timeline not descended from the base backup.

Failing to retain the timeline history file and corresponding WAL.

Treating timeline selection as a stopping target or promotion command.

Workload guidance

OLAP: For a large restore, budget WAL replay and inspection time first. Validate the reached point read-only; do not let heavy analytical queries delay or contaminate the recovery decision.

OLTP: This is not a steady-state performance knob. Set recovery_target_timeline only on an isolated recovery instance after recording target evidence, base backup, timeline, and expected boundary; rehearse and require a second-person review.

SMALL: Prefer a backup tool that generates a controlled recovery configuration. Never leave target settings in ordinary primary/standby templates, and clean up signal files and targets afterward.

Version history 4
  1. PG 16 → 17changed
  2. PG 15 → 16changed
  3. PG 13 → 14changed
  4. PG 11 → 12added

Related entries

Further reading

Definition snapshot: english-manuals:ebf542339c331bc69bd84e8656d… · English manual source