Configuration parameter

recovery_target_time — PostgreSQL configuration parameter

Category Write Ahead Log

This parameter specifies the time stamp up to which recovery will proceed.

At a glance

Property Value
Parameter recovery_target_time
Category Write Ahead Log
Default (see documentation)
Value type timestamp
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 time stamp up to which recovery will proceed. The precise stopping point is also influenced by recovery_target_inclusive.

The value of this parameter is a time stamp in the same format accepted by the timestamp with time zone data type, except that you cannot use a time zone abbreviation (unless the timezone_abbreviations variable has been set earlier in the configuration file). Preferred style is to use a numeric offset from UTC, or you can write a full time zone name, e.g., Europe/Helsinki not EEST.

(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_time; or SELECT name, setting, unit, context, source FROM pg_settings WHERE name = 'recovery_target_time';.

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.

Reference

PostgreSQL documentation — recovery_target_time.

Keep going

Related & next steps

Was this helpful?

← All configuration parameters