{"Entry":{"collection":"guc","key":"bgwriter_lru_maxpages","name":"bgwriter_lru_maxpages","aliases":[],"metadata":{"baseline":false,"boot_human":"Not specified","boot_val":null,"category":"Resource Usage / Background Writer","category_zh":"","changed_in":["10","18"],"changes":[{"documentation_changed":false,"fields":{},"from":"8.0","status":"added","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":false,"fields":{"max_val":{"from":"1000","to":"1073741823"}},"from":"9.6","status":"changed","to":"10"},{"documentation_changed":false,"fields":{"extra_desc":{"from":null,"to":"0 disables background writing."}},"from":"17","status":"changed","to":"18"}],"content_hash":"d81666d7f53f5d44fb595524827ee1b39239bbab81ed6b2d5583bb9233715a32","context":"","default_changed_in":[],"default_history":[{"from":"9.0","to":"19","value":"100"}],"derived_content_hash":"af6543a909e2ef4b7bc8f61b6cc6e1d39be68aa3a633b1e044c39221a4895cbc","editorial":{"advice":{"olap":"Bulk writes can reach bgwriter_lru_maxpages limits continuously. Measure total bytes written, checkpoints, and storage queueing, not just foreground query latency.","oltp":"Tune bgwriter_lru_maxpages 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_maxpages can consume I/O needed by foreground work, so retain the default unless backend writes are a measured problem."},"mechanism":["bgwriter_lru_maxpages caps how many LRU-selected dirty buffers the background writer writes in one round. Zero disables this background-writing activity but does not disable checkpoints.","The writer tries to create enough clean reusable buffers for predicted demand, but this cap bounds each round. If it is reached repeatedly, foreground backends may still have to write buffers themselves.","The prediction comes from recent allocations multiplied by bgwriter_lru_multiplier, and rounds are separated by bgwriter_delay. Raising the cap can smooth latency at the cost of extra write amplification. Its SIGHUP context allows configuration reload without a server restart."],"pitfalls":["Changing bgwriter_lru_maxpages 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_maxpages","url":"https://www.postgresql.org/docs/19/runtime-config-resource.html#GUC-BGWRITER-LRU-MAXPAGES"},{"title":"PostgreSQL 19 release notes","url":"https://www.postgresql.org/docs/19/release-19.html"}],"related":["bgwriter_lru_multiplier","bgwriter_delay","bgwriter_flush_after","shared_buffers","checkpoint_completion_target"],"summary":"bgwriter_lru_maxpages — Background writer maximum number of LRU pages to flush per round. Observed in PG9.0–19 Beta 4; its last measured boot default is 100 in PG19 Beta 4, with sighup context. This is a beta-snapshot fact and can change before PostgreSQL 19 GA."},"enumvals":[],"first_version":"8.1","group":"Resource Usage","group_slug":"resource","imported_at":"2026-09-27T17:57:30.887956+08:00","intro_commit":{},"key":"bgwriter_lru_maxpages","last_version":"20","max_val":"","min_val":"","name":"bgwriter_lru_maxpages","position":45,"present_in":["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:cecf294c06db6e3d428d15f0cbd2c451b2d084c43d6f8d7e3c695885883255e6","receipt_sha256":"5302054fc1d616273d866354081b75778512c3e43f42e1e6246b6d8265fae2c1","repair":"wiki-repair-20261023"},"short_desc":"In each round, no more than this many buffers will be written by the background writer.","short_desc_zh":"","source_rev":"wiki-repair-20261023:5ec1de90083c2f1b483476a03e8d1f9ff814b898082d0060afa7e75a8645b9ce","unit":"","vartype":"integer"}},"Definition":{"Collection":"guc","Key":"bgwriter_lru_maxpages","SourceDatabase":"center","Version":"18","SourceTable":"guc","SourceKey":"bgwriter_lru_maxpages","SourceRevision":"wiki-repair-20261023:5ec1de90083c2f1b483476a03e8d1f9ff814b898082d0060afa7e75a8645b9ce","Facts":{"boot_val":"100","category":"Resource Usage / Background Writer","context":"sighup","description":"In each round, no more than this many buffers will be written by the background writer. Setting this to zero disables background writing. (Note that checkpoints, which are managed by a separate, dedicated auxiliary process, are unaffected.) The default value is 100 buffers. This parameter can only be set in the postgresql.conf file or on the server command line.","description_zh":"后台写入器每轮写出的缓冲区数量不会超过此值。设为零会禁用后台写入。（由另一个独立的专用辅助进程管理的检查点不受影响。）默认值为 100 个缓冲区。此参数只能在 postgresql.conf 文件中或服务器命令行上设置。","description_zh_html":"\u003cp\u003e\n        后台写入器每轮写出的缓冲区数量不会超过此值。设为零会禁用后台写入。（由另一个独立的专用辅助进程管理的检查点不受影响。）默认值为 100 个缓冲区。此参数只能在 \u003ccode class=\"filename\"\u003epostgresql.conf\u003c/code\u003e 文件中或服务器命令行上设置。\n       \u003c/p\u003e","doc":{"anchor":"GUC-BGWRITER-LRU-MAXPAGES","file":"runtime-config-resource.html","lang":"en","sha256":"2e207c599f0884dfbe594558c478a2c7c132578981071e980e2015f31dfce28c","slug":"18"},"documented":true,"enumvals":null,"extra_desc":"0 disables background writing.","lang":"en","max_val":"1073741823","metadata_version":"18","min_val":"0","name":"bgwriter_lru_maxpages","short_desc":"Background writer maximum number of LRU pages to flush 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":"integer","zh_from":"same-version-pgdoc"},"ManualEvidence":{"doc":{"anchor":"GUC-BGWRITER-LRU-MAXPAGES","file":"runtime-config-resource.html","lang":"en","sha256":"2e207c599f0884dfbe594558c478a2c7c132578981071e980e2015f31dfce28c","slug":"18"}},"MeasuredEvidence":{"metadata_version":"18"}},"Text":{"Collection":"guc","Key":"bgwriter_lru_maxpages","SourceDatabase":"center","Version":"18","Locale":"en","Title":"bgwriter_lru_maxpages","Summary":"In each round, no more than this many buffers will be written by the background writer. Setting this to zero disables background writing. (Note that checkpoints, which are managed by a separate, dedicated auxiliary process, are unaffected.) The default value is 100 buffers. This parameter can only be set in the postgresql.conf file or on the server command line.","BodyHTML":"\u003cp\u003eIn each round, no more than this many buffers will be written by the background writer. Setting this to zero disables background writing. (Note that checkpoints, which are managed by a separate, dedicated auxiliary process, are unaffected.) The default value is 100 buffers. This parameter can only be set in the postgresql.conf file or on the server command line.\u003c/p\u003e","SourceRevision":"wiki-repair-20261023:5ec1de90083c2f1b483476a03e8d1f9ff814b898082d0060afa7e75a8645b9ce","ContentHash":"49e79c8ba580bd0c0209934b7a056eca11a0019819a98002a0470db46ffdc6ac","Payload":{"description":"In each round, no more than this many buffers will be written by the background writer. Setting this to zero disables background writing. (Note that checkpoints, which are managed by a separate, dedicated auxiliary process, are unaffected.) The default value is 100 buffers. 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.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}
