26.2. Recovery Target Settings
By default, recovery will recover to the end of the WAL log. The following parameters can be used to specify an earlier stopping point. At most one of recovery_target
, recovery_target_name
, recovery_target_time
, or recovery_target_xid
can be used; if more than one of these is specified in the configuration file, the last entry will be used.
-
recovery_target
= 'immediate'
-
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. -
recovery_target_name
(string
) -
This parameter specifies the named restore point (created with
pg_create_restore_point()
) to which recovery will proceed. -
recovery_target_time
(timestamp
) -
This parameter specifies the time stamp up to which recovery will proceed. The precise stopping point is also influenced by recovery_target_inclusive.
-
recovery_target_xid
(string
) -
This parameter specifies the transaction ID up to which recovery will proceed. Keep in mind that while transaction IDs are assigned sequentially at transaction start, transactions can complete in a different numeric order. The transactions that will be recovered are those that committed before (and optionally including) the specified one. The precise stopping point is also influenced by recovery_target_inclusive.
The following options further specify the recovery target, and affect what happens when the target is reached:
-
recovery_target_inclusive
(boolean
) -
Specifies whether to stop just after the specified recovery target (
true
), or just before the recovery target (false
). Applies when either recovery_target_time or recovery_target_xid is specified. This setting controls whether transactions having exactly the target commit time or ID, respectively, will be included in the recovery. Default istrue
. -
recovery_target_timeline
(string
) -
Specifies recovering into a particular timeline. The default is to recover along the same timeline that was current when the base backup was taken. Setting this to
latest
recovers to the latest timeline found in the archive, which is useful in a standby server. Other than that you 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 24.3.5 for discussion. -
pause_at_recovery_target
(boolean
) -
Specifies whether recovery should pause when the recovery target is reached. The default is true. This is intended to allow queries to be executed against the database to check if this recovery target is the most desirable point for recovery. The paused state can be resumed by using
pg_xlog_replay_resume()
(see Table 9-67), which then causes recovery to end. If this recovery target is not the desired stopping point, then shut down the server, change the recovery target settings to a later target and restart to continue recovery.This setting has no effect if hot_standby is not enabled, or if no recovery target is set.
© 1996–2019 The PostgreSQL Global Development Group
Licensed under the PostgreSQL License.
https://www.postgresql.org/docs/9.4/recovery-target-settings.html