{"Entry":{"collection":"guc","key":"vacuum_defer_cleanup_age","name":"vacuum_defer_cleanup_age","aliases":[],"metadata":{"baseline":false,"boot_human":"0","boot_val":"0","category":"Replication / Primary Server","category_zh":"","changed_in":["9.1","14"],"changes":[{"documentation_changed":false,"fields":{},"from":"8.4","status":"added","to":"9.0"},{"documentation_changed":true,"fields":{"category":{"from":"Write-Ahead Log / Streaming Replication","to":"Replication / Master Server"}},"from":"9.0","status":"changed","to":"9.1"},{"documentation_changed":true,"fields":{},"from":"9.1","status":"changed","to":"9.2"},{"documentation_changed":true,"fields":{},"from":"9.5","status":"changed","to":"9.6"},{"documentation_changed":true,"fields":{"category":{"from":"Replication / Master Server","to":"Replication / Primary Server"}},"from":"13","status":"changed","to":"14"},{"documentation_changed":false,"fields":{},"from":"15","status":"removed","to":"16"}],"content_hash":"74bd6ad481fa3de14dbc75afdf6b3e42aaf6892a306974a435f4efddfa16582c","context":"sighup","default_changed_in":[],"default_history":[{"from":"9.0","to":"15","value":"0"}],"editorial":{"advice":{"olap":"Use the same migration path as OLTP, and also verify long batches, standbys, or large-object/extension workflows; removal of the old switch does not promise identical legacy behavior.","oltp":"Do not tune or continue emitting vacuum_defer_cleanup_age on PG16+. PostgreSQL 16 removed this transaction-count delay; use hot_standby_feedback, replication slots, and bounded standby-conflict policy according to the actual requirement. Scan every configuration layer and regression-test the application before upgrade.","small":"Delete the obsolete setting and adopt the supported replacement directly; do not emulate legacy behavior in scripts without a demonstrated compatibility requirement."},"mechanism":["Number of transactions by which VACUUM and HOT cleanup should be deferred, if any. The parameter still exists in PG15 and is no longer recognized from PG16. PostgreSQL 16 removed this transaction-count delay; use hot_standby_feedback, replication slots, and bounded standby-conflict policy according to the actual requirement.","This postponed removal of recently dead tuples by a fixed number of transactions on the primary, an imprecise way to protect standby queries. It could retain bloat without guaranteeing a wall-clock delay and was removed in PostgreSQL 16.","Before upgrading, inspect synchronized_standby_slots, synchronous_standby_names, hot_standby, remove the old name from configuration, ALTER SYSTEM, role/database settings, and automation templates, and verify the replacement before starting PG16 or later."],"pitfalls":["Continuing to emit unknown parameter vacuum_defer_cleanup_age on PG16+.","Deleting only the setting name without migrating dependent application behavior.","Assuming the historical default equals the replacement mechanism's default.","Missing stale entries in ALTER SYSTEM, role/database settings, or automation templates."],"references":[{"title":"PostgreSQL 15: vacuum_defer_cleanup_age","url":"https://www.postgresql.org/docs/15/runtime-config-replication.html#GUC-VACUUM-DEFER-CLEANUP-AGE"}],"related":["synchronized_standby_slots","synchronous_standby_names","hot_standby","hot_standby_feedback","idle_replication_slot_timeout","max_active_replication_origins"],"summary":"vacuum_defer_cleanup_age — Number of transactions by which VACUUM and HOT cleanup should be deferred, if any. Observed in PG9.0–15; its last measured boot default is 0 in PG15, with sighup context. It was removed in PG16."},"enumvals":[],"first_version":"9.0","group":"Replication","group_slug":"replication","imported_at":"2026-09-27T17:57:32.282944+08:00","intro_commit":{},"key":"vacuum_defer_cleanup_age","last_version":"15","max_val":"1000000","min_val":"0","name":"vacuum_defer_cleanup_age","position":451,"present_in":["9.0","9.1","9.2","9.3","9.4","9.5","9.6","10","11","12","13","14","15"],"short_desc":"Specifies the number of transactions by which VACUUM and HOT updates will defer cleanup of dead row versions.","short_desc_zh":"","source_rev":"english-manuals:b721c05445c0c4b7ea033bbdd7ed557d8847d4ac09fd4ae92b14b5f838d39d46","unit":"","vartype":"integer"}},"Definition":{"Collection":"guc","Key":"vacuum_defer_cleanup_age","SourceDatabase":"center","Version":"15","SourceTable":"guc","SourceKey":"vacuum_defer_cleanup_age","SourceRevision":"english-manuals:b721c05445c0c4b7ea033bbdd7ed557d8847d4ac09fd4ae92b14b5f838d39d46","Facts":{"boot_val":"0","category":"Replication / Primary Server","context":"sighup","description":"Specifies the number of transactions by which VACUUM and HOT updates will defer cleanup of dead row versions. The default is zero transactions, meaning that dead row versions can be removed as soon as possible, that is, as soon as they are no longer visible to any open transaction. You may wish to set this to a non-zero value on a primary server that is supporting hot standby servers, as described in Section 27.4. This allows more time for queries on the standby to complete without incurring conflicts due to early cleanup of rows. However, since the value is measured in terms of number of write transactions occurring on the primary server, it is difficult to predict just how much additional grace time will be made available to standby queries. This parameter can only be set in the postgresql.conf file or on the server command line. You should also consider setting hot_standby_feedback on standby server(s) as an alternative to using this parameter. This does not prevent cleanup of dead rows which have reached the age specified by old_snapshot_threshold.","doc":{"anchor":"GUC-VACUUM-DEFER-CLEANUP-AGE","file":"runtime-config-replication.html","lang":"en","sha256":"ef03eaf0fb810253eda4b9183c03683b99b8d425f393d3bc69e906514425a34d","slug":"15"},"documented":true,"enumvals":null,"extra_desc":null,"lang":"en","max_val":"1000000","metadata_version":"15","min_val":"0","name":"vacuum_defer_cleanup_age","short_desc":"Number of transactions by which VACUUM and HOT cleanup should be deferred, if any.","source":"pg-settings-source-snapshot","unit":null,"vartype":"integer"},"ManualEvidence":{"doc":{"anchor":"GUC-VACUUM-DEFER-CLEANUP-AGE","file":"runtime-config-replication.html","lang":"en","sha256":"ef03eaf0fb810253eda4b9183c03683b99b8d425f393d3bc69e906514425a34d","slug":"15"}},"MeasuredEvidence":{"metadata_version":"15"}},"Text":{"Collection":"guc","Key":"vacuum_defer_cleanup_age","SourceDatabase":"pgweb","Version":"15","Locale":"zh-Hans","Title":"vacuum_defer_cleanup_age","Summary":"","BodyHTML":"\u003cp\u003e指定\u003ccode\u003eVACUUM\u003c/code\u003e和\u003ca href=\"/docs/15/storage-hot.html\" rel=\"nofollow\"\u003eHOT更新\u003c/a\u003e延迟清理死行版本的事务数。默认值为零个事务，意味着可以尽快移除死行版本，也就是在它们不再对任何打开的事务可见时立即移除。如\u003ca href=\"/docs/15/hot-standby.html\" rel=\"nofollow\"\u003e第 27.4 节\u003c/a\u003e所述，在为热备服务器提供支持的主库上，你可能希望将此参数设置为非零值。这让备库上的查询有更多时间完成，而不会因过早清理行而发生冲突。但是，由于此值以主库上发生的写事务数计量，很难预测会给备库查询带来多少额外的宽限时间。此参数只能在\u003ccode\u003epostgresql.conf\u003c/code\u003e文件中或在服务器命令行上设置。\u003c/p\u003e\u003cp\u003e你也应考虑在备库上设置\u003ccode\u003ehot_standby_feedback\u003c/code\u003e，作为使用此参数的替代方案。\u003c/p\u003e\u003cp\u003e这不会阻止清理已经达到\u003ccode\u003eold_snapshot_threshold\u003c/code\u003e指定年龄的死行。\u003c/p\u003e","SourceRevision":"2026-09-11@29c86d9","ContentHash":"3d27efcfc463791ada79cb0b47066f1bb7c6a96c61ca2746b35063e5ce1a2b2a","Payload":{"carried_from":"","carry_reason":"","doc_html":"\u003cp\u003e指定\u003ccode class=\"command\"\u003eVACUUM\u003c/code\u003e和\u003ca href=\"/docs/15/storage-hot.html\" title=\"73.7. 堆内元组（HOT）\"\u003eHOT更新\u003c/a\u003e延迟清理死行版本的事务数。默认值为零个事务，意味着可以尽快移除死行版本，也就是在它们不再对任何打开的事务可见时立即移除。如\u003ca href=\"/docs/15/hot-standby.html\" title=\"27.4. 热备\"\u003e第 27.4 节\u003c/a\u003e所述，在为热备服务器提供支持的主库上，你可能希望将此参数设置为非零值。这让备库上的查询有更多时间完成，而不会因过早清理行而发生冲突。但是，由于此值以主库上发生的写事务数计量，很难预测会给备库查询带来多少额外的宽限时间。此参数只能在\u003ccode class=\"filename\"\u003epostgresql.conf\u003c/code\u003e文件中或在服务器命令行上设置。\u003c/p\u003e\u003cp\u003e你也应考虑在备库上设置\u003ccode class=\"varname\"\u003ehot_standby_feedback\u003c/code\u003e，作为使用此参数的替代方案。\u003c/p\u003e\u003cp\u003e这不会阻止清理已经达到\u003ccode class=\"varname\"\u003eold_snapshot_threshold\u003c/code\u003e指定年龄的死行。\u003c/p\u003e","doc_same_as":""}},"RequestedLocale":"zh-Hans","Fallback":false,"Versions":["10","11","12","13","14","15","9.0","9.1","9.2","9.3","9.4","9.5","9.6"],"Locales":["en","zh-Hans"],"Signatures":null,"Spellings":null,"SQLState":null,"Evidence":null}
