{"Entry":{"collection":"guc","key":"recovery_target_timeline","name":"recovery_target_timeline","aliases":[],"metadata":{"baseline":false,"boot_human":"Not specified","boot_val":null,"category":"Write-Ahead Log / Recovery Target","category_zh":"","changed_in":[],"changes":[{"documentation_changed":false,"fields":{},"from":"11","status":"added","to":"12"},{"documentation_changed":true,"fields":{},"from":"13","status":"changed","to":"14"},{"documentation_changed":true,"fields":{},"from":"15","status":"changed","to":"16"},{"documentation_changed":true,"fields":{},"from":"16","status":"changed","to":"17"}],"content_hash":"72e8e1318be5bdf6e4b03fc3e6fd9d4e3c5d32cbabbc826cfb15b5e8b4dc0262","context":"","default_changed_in":[],"default_history":[{"from":"12","to":"19","value":"latest"}],"editorial":{"advice":{"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."},"mechanism":["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."],"pitfalls":["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."],"references":[{"title":"PostgreSQL 19 Beta 4: recovery_target_timeline","url":"https://www.postgresql.org/docs/19/runtime-config-wal.html#GUC-RECOVERY-TARGET-TIMELINE"},{"title":"PostgreSQL 19 release notes","url":"https://www.postgresql.org/docs/19/release-19.html"}],"related":["recovery_target","recovery_target_time","recovery_target_lsn","recovery_target_action","restore_command","primary_conninfo"],"summary":"recovery_target_timeline specifies the timeline to recover into. It is a postmaster setting present in PG12–18; the latest recorded boot default is latest."},"enumvals":[],"first_version":"12","group":"Write-Ahead Log","group_slug":"wal","imported_at":"2026-09-27T17:57:31.888297+08:00","intro_commit":{"authored_at":"2018-11-25T16:31:16+01:00","discussion":["https://www.postgresql.org/message-id/flat/607741529606767@web3g.yandex.ru/"],"hash":"2dedf4d9a899b36d1a8ed29be5efbd1b31a8fe85","subject":"Integrate recovery.conf into postgresql.conf","url":"https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=2dedf4d9a899b36d1a8ed29be5efbd1b31a8fe85"},"key":"recovery_target_timeline","last_version":"20","max_val":"","min_val":"","name":"recovery_target_timeline","position":331,"present_in":["12","13","14","15","16","17","18","19","20"],"short_desc":"Specifies recovering into a particular timeline.","short_desc_zh":"","source_rev":"english-manuals:f5632975ea1053bad71ce44a1908209efe7434fc97981ba668a93defbc92fc14","unit":"","vartype":"string"}},"Definition":{"Collection":"guc","Key":"recovery_target_timeline","SourceDatabase":"center","Version":"18","SourceTable":"guc","SourceKey":"recovery_target_timeline","SourceRevision":"english-manuals:f5632975ea1053bad71ce44a1908209efe7434fc97981ba668a93defbc92fc14","Facts":{"boot_val":"latest","category":"Write-Ahead Log / Recovery Target","context":"postmaster","description":"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.","doc":{"anchor":"GUC-RECOVERY-TARGET-TIMELINE","file":"runtime-config-wal.html","lang":"en","sha256":"d2646404a06e8f7ac655204b4f28c049ae8f3fd4f2272db080fcefa2c4af0763","slug":"18"},"documented":true,"enumvals":null,"extra_desc":null,"lang":"en","max_val":null,"metadata_version":"18","min_val":null,"name":"recovery_target_timeline","short_desc":"Specifies the timeline to recover into.","source":"pg-settings-source-snapshot","unit":null,"vartype":"string"},"ManualEvidence":{"doc":{"anchor":"GUC-RECOVERY-TARGET-TIMELINE","file":"runtime-config-wal.html","lang":"en","sha256":"d2646404a06e8f7ac655204b4f28c049ae8f3fd4f2272db080fcefa2c4af0763","slug":"18"}},"MeasuredEvidence":{"metadata_version":"18"}},"Text":{"Collection":"guc","Key":"recovery_target_timeline","SourceDatabase":"pgweb","Version":"18","Locale":"zh-Hans","Title":"recovery_target_timeline","Summary":"","BodyHTML":"\u003cp\u003e指定恢复到一个特定的时间线中。该值可以是数字时间线 ID 或特殊值。值\u003ccode\u003ecurrent\u003c/code\u003e沿着与执行基础备份时相同的时间线恢复。值\u003ccode\u003elatest\u003c/code\u003e将恢复到归档中能找到的最新时间线，这在备库中很有用。\u003ccode\u003elatest\u003c/code\u003e是默认值。\u003c/p\u003e\u003cp\u003e如果要以十六进制指定时间线 ID（例如从 WAL 文件名或历史文件中提取），请在前面加上 \u003ccode\u003e0x\u003c/code\u003e。例如，如果 WAL 文件名为 \u003ccode\u003e00000011000000A10000004F\u003c/code\u003e，那么时间线 ID 就是 \u003ccode\u003e0x11\u003c/code\u003e（十进制为 17）。\u003c/p\u003e\u003cp\u003e你通常只需要在复杂的再次恢复场景中设置此参数，也就是当你需要回到某个状态，而该状态本身又是在一次时间点恢复之后达到的。相关讨论见\u003ca href=\"/docs/18/continuous-archiving.html#BACKUP-TIMELINES\" rel=\"nofollow\"\u003e第 25.3.6 节\u003c/a\u003e。\u003c/p\u003e","SourceRevision":"2026-09-11@29c86d9","ContentHash":"1908d8cab52abba8180b26e0f836f8cc266b3ed099e03c8fe3cd15034a8398d7","Payload":{"carried_from":"","carry_reason":"","doc_html":"\u003cp\u003e指定恢复到一个特定的时间线中。该值可以是数字时间线 ID 或特殊值。值\u003ccode class=\"literal\"\u003ecurrent\u003c/code\u003e沿着与执行基础备份时相同的时间线恢复。值\u003ccode class=\"literal\"\u003elatest\u003c/code\u003e将恢复到归档中能找到的最新时间线，这在备库中很有用。\u003ccode class=\"literal\"\u003elatest\u003c/code\u003e是默认值。\u003c/p\u003e\u003cp\u003e如果要以十六进制指定时间线 ID（例如从 WAL 文件名或历史文件中提取），请在前面加上 \u003ccode class=\"literal\"\u003e0x\u003c/code\u003e。例如，如果 WAL 文件名为 \u003ccode class=\"filename\"\u003e00000011000000A10000004F\u003c/code\u003e，那么时间线 ID 就是 \u003ccode class=\"literal\"\u003e0x11\u003c/code\u003e（十进制为 17）。\u003c/p\u003e\u003cp\u003e你通常只需要在复杂的再次恢复场景中设置此参数，也就是当你需要回到某个状态，而该状态本身又是在一次时间点恢复之后达到的。相关讨论见\u003ca href=\"/docs/18/continuous-archiving.html#BACKUP-TIMELINES\" title=\"25.3.6. 时间线\"\u003e第 25.3.6 节\u003c/a\u003e。\u003c/p\u003e","doc_same_as":""}},"RequestedLocale":"zh-Hans","Fallback":false,"Versions":["12","13","14","15","16","17","18","19","20"],"Locales":["en","zh-Hans"],"Signatures":null,"Spellings":null,"SQLState":null,"Evidence":null}
