{"Entry":{"collection":"guc","key":"bgwriter_delay","name":"bgwriter_delay","aliases":[],"metadata":{"baseline":false,"boot_human":"Not specified","boot_val":null,"category":"Resource Usage / Background Writer","category_zh":"","changed_in":[],"changes":[{"documentation_changed":false,"fields":{},"from":"7.4","status":"added","to":"8.0"},{"documentation_changed":true,"fields":{},"from":"8.0","status":"changed","to":"8.1"},{"documentation_changed":true,"fields":{},"from":"8.1","status":"changed","to":"8.2"},{"documentation_changed":true,"fields":{},"from":"8.2","status":"changed","to":"8.3"},{"documentation_changed":true,"fields":{},"from":"9.1","status":"changed","to":"9.2"},{"documentation_changed":true,"fields":{},"from":"11","status":"changed","to":"12"},{"documentation_changed":true,"fields":{},"from":"16","status":"changed","to":"17"}],"content_hash":"e15d5c067c830e0f1cd3537a9465396ea342340ce3efd1adf53d76563a207169","context":"","default_changed_in":[],"default_history":[{"from":"9.0","to":"19","value":"200 ms"}],"derived_content_hash":"ab1fb246c2d853fde71835840ceae79044c7f9599558e7ef5f4ae6bb9ea2d6de","editorial":{"advice":{"olap":"Bulk writes can reach bgwriter_delay limits continuously. Measure total bytes written, checkpoints, and storage queueing, not just foreground query latency.","oltp":"Tune bgwriter_delay only with bgwriter and checkpoint metrics. The goal is fewer backend writes and smoother latency without excessive repeated writes; change one dimension at a time.","small":"A small host usually needs conservative write smoothing. Aggressive bgwriter_delay can consume I/O needed by foreground work, so retain the default unless backend writes are a measured problem."},"mechanism":["The background writer performs a round, writes selected dirty shared buffers, then sleeps for bgwriter_delay. When no dirty buffers are found it can enter a longer sleep regardless of this value.","A shorter interval reacts sooner to buffer demand but wakes the process more often. Effective timer granularity can be about 10 ms on some systems, so smaller or non-multiple values may round up in practice.","The number of pages considered per round is derived from recent buffer allocation demand, bgwriter_lru_multiplier, and bgwriter_lru_maxpages; checkpoints are handled separately. Its SIGHUP context allows configuration reload without a server restart."],"pitfalls":["Changing bgwriter_delay without applying its documented unit and configuration context.","Optimizing an isolated benchmark while ignoring concurrent aggregate resource use.","Assuming a configured value guarantees operating-system or storage behavior.","Failing to retest startup, failover, and workload latency after the change."],"references":[{"title":"PostgreSQL 19 Beta 4: bgwriter_delay","url":"https://www.postgresql.org/docs/19/runtime-config-resource.html#GUC-BGWRITER-DELAY"},{"title":"PostgreSQL 19 release notes","url":"https://www.postgresql.org/docs/19/release-19.html"}],"related":["bgwriter_lru_maxpages","bgwriter_lru_multiplier","bgwriter_flush_after","shared_buffers","checkpoint_completion_target"],"summary":"bgwriter_delay — Background writer sleep time between rounds. Observed in PG9.0–19 Beta 4; its last measured boot default is 200 ms in PG19 Beta 4, with sighup context. This is a beta-snapshot fact and can change before PostgreSQL 19 GA."},"enumvals":[],"first_version":"8.0","group":"Resource Usage","group_slug":"resource","imported_at":"2026-09-27T17:57:30.873478+08:00","intro_commit":{},"key":"bgwriter_delay","last_version":"20","max_val":"","min_val":"","name":"bgwriter_delay","position":43,"present_in":["8.0","8.1","8.2","8.3","8.4","9.0","9.1","9.2","9.3","9.4","9.5","9.6","10","11","12","13","14","15","16","17","18","19","20"],"repair_provenance":{"original_source_revision":"english-manuals:7f82ae22d0ec71ac8fa3562b686f652480723f8113b08b19a92fdcf262be9655","receipt_sha256":"de99c504be9f87831177a68dcd0123f95235b2695a46cc1da063a26b6b54299d","repair":"wiki-repair-20261023"},"short_desc":"Specifies the delay between activity rounds for the background writer.","short_desc_zh":"","source_rev":"wiki-repair-20261023:ac7e60f89b393da0beea4fb24dea2838c3353613dece411e21d3c5b1be6555d6","unit":"","vartype":"integer"}},"Definition":{"Collection":"guc","Key":"bgwriter_delay","SourceDatabase":"center","Version":"18","SourceTable":"guc","SourceKey":"bgwriter_delay","SourceRevision":"wiki-repair-20261023:ac7e60f89b393da0beea4fb24dea2838c3353613dece411e21d3c5b1be6555d6","Facts":{"boot_val":"200","category":"Resource Usage / Background Writer","context":"sighup","description":"Specifies the delay between activity rounds for the background writer. In each round the writer issues writes for some number of dirty buffers (controllable by the following parameters). It then sleeps for the length of bgwriter_delay, and repeats. When there are no dirty buffers in the buffer pool, though, it goes into a longer sleep regardless of bgwriter_delay. If this value is specified without units, it is taken as milliseconds. The default value is 200 milliseconds (200ms). Note that on some systems, the effective resolution of sleep delays is 10 milliseconds; setting bgwriter_delay to a value that is not a multiple of 10 might have the same results as setting it to the next higher multiple of 10. This parameter can only be set in the postgresql.conf file or on the server command line.","description_zh":"指定后台写入器各轮活动之间的延迟。每一轮中，写入器会对一定数量的脏缓冲区发出写操作（由下面的参数控制），然后休眠 bgwriter_delay 指定的时长，再重复此过程。不过，当缓冲池中没有脏缓冲区时，它会进入更长的休眠，而不受 bgwriter_delay 限制。如果未指定单位，则以毫秒为单位。默认值为 200 毫秒（200ms）。注意，在某些系统上，休眠延迟的有效分辨率为 10 毫秒；将 bgwriter_delay 设为不是 10 的倍数的值，可能与将它设为下一个更大的 10 的倍数效果相同。此参数只能在 postgresql.conf 文件中或服务器命令行上设置。","description_zh_html":"\u003cp\u003e\n        指定后台写入器各轮活动之间的延迟。每一轮中，写入器会对一定数量的脏缓冲区发出写操作（由下面的参数控制），然后休眠 \u003ccode class=\"varname\"\u003ebgwriter_delay\u003c/code\u003e 指定的时长，再重复此过程。不过，当缓冲池中没有脏缓冲区时，它会进入更长的休眠，而不受 \u003ccode class=\"varname\"\u003ebgwriter_delay\u003c/code\u003e 限制。如果未指定单位，则以毫秒为单位。默认值为 200 毫秒（\u003ccode class=\"literal\"\u003e200ms\u003c/code\u003e）。注意，在某些系统上，休眠延迟的有效分辨率为 10 毫秒；将 \u003ccode class=\"varname\"\u003ebgwriter_delay\u003c/code\u003e 设为不是 10 的倍数的值，可能与将它设为下一个更大的 10 的倍数效果相同。此参数只能在 \u003ccode class=\"filename\"\u003epostgresql.conf\u003c/code\u003e 文件中或服务器命令行上设置。\n       \u003c/p\u003e","doc":{"anchor":"GUC-BGWRITER-DELAY","file":"runtime-config-resource.html","lang":"en","sha256":"2e207c599f0884dfbe594558c478a2c7c132578981071e980e2015f31dfce28c","slug":"18"},"documented":true,"enumvals":null,"extra_desc":null,"lang":"en","max_val":"10000","metadata_version":"18","min_val":"10","name":"bgwriter_delay","short_desc":"Background writer sleep time between rounds.","source":"pg-settings-source-snapshot","translation_provenance":{"inputs":[{"kind":"current-pgdoc-translation","path":"/Users/vonng/pgsty/pgdoc/zh/18/html/runtime-config-resource.html","sha256":"f5fedbf88ec5f973aaf4e525c03e46dda2a2186dabee154e26780da96b2ac85a"}],"kind":"same-version-pgdoc","locale":"zh-Hans","source_revision":"b1b500221dbe5437cfca004d6b04d3f6e422765d","version":"18"},"unit":"ms","vartype":"integer","zh_from":"same-version-pgdoc"},"ManualEvidence":{"doc":{"anchor":"GUC-BGWRITER-DELAY","file":"runtime-config-resource.html","lang":"en","sha256":"2e207c599f0884dfbe594558c478a2c7c132578981071e980e2015f31dfce28c","slug":"18"}},"MeasuredEvidence":{"metadata_version":"18"}},"Text":{"Collection":"guc","Key":"bgwriter_delay","SourceDatabase":"center","Version":"18","Locale":"en","Title":"bgwriter_delay","Summary":"Specifies the delay between activity rounds for the background writer. In each round the writer issues writes for some number of dirty buffers (controllable by the following parameters). It then sleeps for the length of bgwriter_delay, and repeats. When there are no dirty buffers in the buffer pool, though, it goes into a longer sleep regardless of bgwriter_delay. If this value is specified without units, it is taken as milliseconds. The default value is 200 milliseconds (200ms). Note that on some systems, the effective resolution of sleep delays is 10 milliseconds; setting bgwriter_delay to a value that is not a multiple of 10 might have the same results as setting it to the next higher multiple of 10. This parameter can only be set in the postgresql.conf file or on the server command line.","BodyHTML":"\u003cp\u003eSpecifies the delay between activity rounds for the background writer. In each round the writer issues writes for some number of dirty buffers (controllable by the following parameters). It then sleeps for the length of bgwriter_delay, and repeats. When there are no dirty buffers in the buffer pool, though, it goes into a longer sleep regardless of bgwriter_delay. If this value is specified without units, it is taken as milliseconds. The default value is 200 milliseconds (200ms). Note that on some systems, the effective resolution of sleep delays is 10 milliseconds; setting bgwriter_delay to a value that is not a multiple of 10 might have the same results as setting it to the next higher multiple of 10. This parameter can only be set in the postgresql.conf file or on the server command line.\u003c/p\u003e","SourceRevision":"wiki-repair-20261023:ac7e60f89b393da0beea4fb24dea2838c3353613dece411e21d3c5b1be6555d6","ContentHash":"5c6f6b23f617a168867bee93c867306283cac6cbc1531a9d11273f88f9d7220e","Payload":{"description":"Specifies the delay between activity rounds for the background writer. In each round the writer issues writes for some number of dirty buffers (controllable by the following parameters). It then sleeps for the length of bgwriter_delay, and repeats. When there are no dirty buffers in the buffer pool, though, it goes into a longer sleep regardless of bgwriter_delay. If this value is specified without units, it is taken as milliseconds. The default value is 200 milliseconds (200ms). Note that on some systems, the effective resolution of sleep delays is 10 milliseconds; setting bgwriter_delay to a value that is not a multiple of 10 might have the same results as setting it to the next higher multiple of 10. This parameter can only be set in the postgresql.conf file or on the server command line."}},"RequestedLocale":"en","Fallback":false,"Versions":["10","11","12","13","14","15","16","17","18","19","20","8.0","8.1","8.2","8.3","8.4","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}
