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

Read PG 18 manual ↗

This parameter specifies that recovery should end as soon as a consistent state is reached, i.e., as early as possible.

Type
string
Context
postmaster
Measured default
Empty string
Unit
Metadata snapshot
18

Definition PG 18 manual

This parameter specifies that recovery should end as soon as a consistent state is reached, i.e., as early as possible. When restoring from an online backup, this means the point where taking the backup ended.

Technically, this is a string parameter, but 'immediate' is currently the only allowed value.

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

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

How it works

Set to "immediate" to end recovery as soon as a consistent state is reached. The value is fixed when the server starts, so changing it requires a restart.

The only accepted value is immediate, which stops targeted recovery at the first consistent point—normally the end of an online base backup. It is mutually exclusive with the LSN, name, time, and XID target selectors.

At most one of recovery_target, recovery_target_lsn, recovery_target_name, recovery_target_time, and recovery_target_xid may be set; timeline, inclusive, and action are modifiers. Rehearse from the same base backup through a complete WAL chain—an unreachable target makes targeted recovery fail.

Operational considerations

Setting immediate together with an LSN, name, time, or XID selector.

Confusing the first consistent point after an online backup with the desired business recovery point.

Leaving immediate in a normal standby configuration and ending recovery unexpectedly.

Starting without recovery.signal and assuming the target will control crash recovery.

Assuming success when the required WAL chain never reaches a consistent point.

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 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 1
  1. PG 11 → 12added

Related entries

Further reading

Definition snapshot: english-manuals:00a922a7b651d76e125b1e77085… · English manual source