This parameter specifies the LSN of the write-ahead log location up to which recovery will proceed.
At a glance
| Property | Value |
|---|---|
| Parameter | recovery_target_lsn |
| Category | Write Ahead Log |
| Default | (see documentation) |
| Value type | LSN (pg_lsn) |
| Change scope | Per-session (SET) |
| Available in | PostgreSQL 12, 13, 14, 15, 16, 17, 18, 19 (added in 12) |
What it does
This parameter specifies the LSN of the write-ahead log location up to which recovery will proceed. The precise stopping point is also influenced by recovery_target_inclusive. This parameter is parsed using the system data type pg_lsn.
(Description quoted from the official PostgreSQL documentation.)
How to apply a change
Can be set per session with SET, per role/database with ALTER ROLE/DATABASE ... SET, or globally in postgresql.conf.
Inspect the current value and source with SHOW recovery_target_lsn; or SELECT name, setting, unit, context, source FROM pg_settings WHERE name = 'recovery_target_lsn';.
Tuning guidance
This is a point-in-time-recovery control, used only while restoring a backup, not during normal operation. Set it in the recovery configuration to define the exact stopping point or restore action you want, perform the recovery, then remove it. It has no effect on a normally running primary.