{"Entry":{"collection":"guc","key":"bgwriter_lru_multiplier","name":"bgwriter_lru_multiplier","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":"8.2","status":"added","to":"8.3"},{"documentation_changed":true,"fields":{},"from":"9.6","status":"changed","to":"10"}],"content_hash":"7bce42112bf52b3bcb59a47446ad0d25d223ca91e6f44c98ac814bea253f2f28","context":"","default_changed_in":[],"default_history":[{"from":"9.0","to":"19","value":"2"}],"derived_content_hash":"673e7f46f4b910723d88d22b9f3b355797482dc0cab01fb5f59e9fc620a3e808","editorial":{"advice":{"olap":"Bulk writes can reach bgwriter_lru_multiplier limits continuously. Measure total bytes written, checkpoints, and storage queueing, not just foreground query latency.","oltp":"Tune bgwriter_lru_multiplier 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_lru_multiplier can consume I/O needed by foreground work, so retain the default unless backend writes are a measured problem."},"mechanism":["The background writer averages recent buffer allocations and multiplies that demand by bgwriter_lru_multiplier to choose a target number of clean reusable buffers. A value above 1 adds cushion for bursts.","This is a forecast multiplier, not a direct number of pages. Actual writes remain capped by bgwriter_lru_maxpages and occur once per bgwriter_delay round.","More cushion can reduce foreground backend writes and latency spikes, but pages dirtied repeatedly between checkpoints may be written more times, increasing total I/O. Its SIGHUP context allows configuration reload without a server restart."],"pitfalls":["Changing bgwriter_lru_multiplier 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_lru_multiplier","url":"https://www.postgresql.org/docs/19/runtime-config-resource.html#GUC-BGWRITER-LRU-MULTIPLIER"},{"title":"PostgreSQL 19 release notes","url":"https://www.postgresql.org/docs/19/release-19.html"}],"related":["bgwriter_lru_maxpages","bgwriter_delay","bgwriter_flush_after","shared_buffers","checkpoint_completion_target"],"summary":"bgwriter_lru_multiplier — Multiple of the average buffer usage to free per round. Observed in PG9.0–19 Beta 4; its last measured boot default is 2 in PG19 Beta 4, with sighup context. This is a beta-snapshot fact and can change before PostgreSQL 19 GA."},"enumvals":[],"first_version":"8.3","group":"Resource Usage","group_slug":"resource","imported_at":"2026-09-27T17:57:30.891953+08:00","intro_commit":{},"key":"bgwriter_lru_multiplier","last_version":"20","max_val":"","min_val":"","name":"bgwriter_lru_multiplier","position":46,"present_in":["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:176e0f4cd76e4d71ef42d2b2174fa8dd11337a0317853831e2cb7db78017fb9a","receipt_sha256":"b8ac7d9877156829629415dc240e02722d2313c7dcb61eb7e12823b0364a6a6c","repair":"wiki-repair-20261023"},"short_desc":"The number of dirty buffers written in each round is based on the number of new buffers that have been needed by server processes during recent rounds.","short_desc_zh":"","source_rev":"wiki-repair-20261023:32e2b7063a7ee1df65f9b0e09ea1fc763869b868383188b49cbcc67caf5b5d5d","unit":"","vartype":"real"}},"Definition":{"Collection":"guc","Key":"bgwriter_lru_multiplier","SourceDatabase":"center","Version":"18","SourceTable":"guc","SourceKey":"bgwriter_lru_multiplier","SourceRevision":"wiki-repair-20261023:32e2b7063a7ee1df65f9b0e09ea1fc763869b868383188b49cbcc67caf5b5d5d","Facts":{"boot_val":"2","category":"Resource Usage / Background Writer","context":"sighup","description":"The number of dirty buffers written in each round is based on the number of new buffers that have been needed by server processes during recent rounds. The average recent need is multiplied by bgwriter_lru_multiplier to arrive at an estimate of the number of buffers that will be needed during the next round. Dirty buffers are written until there are that many clean, reusable buffers available. (However, no more than bgwriter_lru_maxpages buffers will be written per round.) Thus, a setting of 1.0 represents a “just in time” policy of writing exactly the number of buffers predicted to be needed. Larger values provide some cushion against spikes in demand, while smaller values intentionally leave writes to be done by server processes. The default is 2.0. This parameter can only be set in the postgresql.conf file or on the server command line.","description_zh":"每轮写出的脏缓冲区数量取决于最近几轮服务器进程所需的新缓冲区数量。将近期平均需求乘以 bgwriter_lru_multiplier，即可估算下一轮所需的缓冲区数量。写入器会写出脏缓冲区，直到可用的干净且可重用缓冲区达到这一数量。（不过，每轮写出的缓冲区数量不会超过 bgwriter_lru_maxpages。）因此，设为 1.0 表示采用“恰好及时”策略，写出的缓冲区数量恰好等于预测需求量。更大的值可为需求突增留出余量，而更小的值则有意将部分写操作留给服务器进程执行。默认值为 2.0。此参数只能在 postgresql.conf 文件中或服务器命令行上设置。","description_zh_html":"\u003cp\u003e\n        每轮写出的脏缓冲区数量取决于最近几轮服务器进程所需的新缓冲区数量。将近期平均需求乘以 \u003ccode class=\"varname\"\u003ebgwriter_lru_multiplier\u003c/code\u003e，即可估算下一轮所需的缓冲区数量。写入器会写出脏缓冲区，直到可用的干净且可重用缓冲区达到这一数量。（不过，每轮写出的缓冲区数量不会超过 \u003ccode class=\"varname\"\u003ebgwriter_lru_maxpages\u003c/code\u003e。）因此，设为 1.0 表示采用\u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003e恰好及时\u003c/span\u003e”\u003c/span\u003e策略，写出的缓冲区数量恰好等于预测需求量。更大的值可为需求突增留出余量，而更小的值则有意将部分写操作留给服务器进程执行。默认值为 2.0。此参数只能在 \u003ccode class=\"filename\"\u003epostgresql.conf\u003c/code\u003e 文件中或服务器命令行上设置。\n       \u003c/p\u003e","doc":{"anchor":"GUC-BGWRITER-LRU-MULTIPLIER","file":"runtime-config-resource.html","lang":"en","sha256":"2e207c599f0884dfbe594558c478a2c7c132578981071e980e2015f31dfce28c","slug":"18"},"documented":true,"enumvals":null,"extra_desc":null,"lang":"en","max_val":"10","metadata_version":"18","min_val":"0","name":"bgwriter_lru_multiplier","short_desc":"Multiple of the average buffer usage to free per round.","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":null,"vartype":"real","zh_from":"same-version-pgdoc"},"ManualEvidence":{"doc":{"anchor":"GUC-BGWRITER-LRU-MULTIPLIER","file":"runtime-config-resource.html","lang":"en","sha256":"2e207c599f0884dfbe594558c478a2c7c132578981071e980e2015f31dfce28c","slug":"18"}},"MeasuredEvidence":{"metadata_version":"18"}},"Text":{"Collection":"guc","Key":"bgwriter_lru_multiplier","SourceDatabase":"center","Version":"18","Locale":"en","Title":"bgwriter_lru_multiplier","Summary":"The number of dirty buffers written in each round is based on the number of new buffers that have been needed by server processes during recent rounds. The average recent need is multiplied by bgwriter_lru_multiplier to arrive at an estimate of the number of buffers that will be needed during the next round. Dirty buffers are written until there are that many clean, reusable buffers available. (However, no more than bgwriter_lru_maxpages buffers will be written per round.) Thus, a setting of 1.0 represents a “just in time” policy of writing exactly the number of buffers predicted to be needed. Larger values provide some cushion against spikes in demand, while smaller values intentionally leave writes to be done by server processes. The default is 2.0. This parameter can only be set in the postgresql.conf file or on the server command line.","BodyHTML":"\u003cp\u003eThe number of dirty buffers written in each round is based on the number of new buffers that have been needed by server processes during recent rounds. The average recent need is multiplied by bgwriter_lru_multiplier to arrive at an estimate of the number of buffers that will be needed during the next round. Dirty buffers are written until there are that many clean, reusable buffers available. (However, no more than bgwriter_lru_maxpages buffers will be written per round.) Thus, a setting of 1.0 represents a “just in time” policy of writing exactly the number of buffers predicted to be needed. Larger values provide some cushion against spikes in demand, while smaller values intentionally leave writes to be done by server processes. The default is 2.0. This parameter can only be set in the postgresql.conf file or on the server command line.\u003c/p\u003e","SourceRevision":"wiki-repair-20261023:32e2b7063a7ee1df65f9b0e09ea1fc763869b868383188b49cbcc67caf5b5d5d","ContentHash":"5bc64c69b5e7aae59a10afd5e68464a1c418da2d1fca3b5cbef654958dc2a645","Payload":{"description":"The number of dirty buffers written in each round is based on the number of new buffers that have been needed by server processes during recent rounds. The average recent need is multiplied by bgwriter_lru_multiplier to arrive at an estimate of the number of buffers that will be needed during the next round. Dirty buffers are written until there are that many clean, reusable buffers available. (However, no more than bgwriter_lru_maxpages buffers will be written per round.) Thus, a setting of 1.0 represents a “just in time” policy of writing exactly the number of buffers predicted to be needed. Larger values provide some cushion against spikes in demand, while smaller values intentionally leave writes to be done by server processes. The default is 2.0. 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.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}
