{"Entry":{"collection":"guc","key":"shared_buffers","name":"shared_buffers","aliases":[],"metadata":{"baseline":true,"boot_human":"Not specified","boot_val":null,"category":"Resource Usage / Memory","category_zh":"","changed_in":["15"],"changes":[{"documentation_changed":true,"fields":{},"from":"7.4","status":"changed","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":"8.3","status":"changed","to":"8.4"},{"documentation_changed":true,"fields":{},"from":"9.2","status":"changed","to":"9.3"},{"documentation_changed":true,"fields":{},"from":"9.4","status":"changed","to":"9.5"},{"documentation_changed":true,"fields":{},"from":"9.6","status":"changed","to":"10"},{"documentation_changed":true,"fields":{},"from":"11","status":"changed","to":"12"},{"documentation_changed":false,"fields":{"boot_val":{"from":"1024","to":"16384"}},"from":"14","status":"changed","to":"15"}],"content_hash":"5e924cff31ec6099e62d7c0a1f26e292cd00a2a6953fe89992b39862cad8f66f","context":"","default_changed_in":["15"],"default_history":[{"from":"9.0","to":"14","value":"8 MiB (1024 × 8kB)"},{"from":"15","to":"19","value":"128 MiB (16384 × 8kB)"}],"editorial":{"advice":{"olap":"Benchmark shared_buffers with representative bulk and scan phases. Include sustained throughput, spill/writeback, and interference with other sessions, not only one operation's elapsed time.","oltp":"Change shared_buffers only after identifying the corresponding resource bottleneck under concurrency. Budget total memory, I/O, disk, or kernel capacity rather than optimizing one process in isolation.","small":"Keep shared_buffers conservative on a small host and prefer the upstream default when evidence is weak. A setting copied from a large server can consume a disproportionate share of resources."},"mechanism":["shared_buffers allocates PostgreSQL's real shared buffer cache at server start. Pages cached here are PostgreSQL-managed and coexist with the operating system page cache; the setting is not merely a planner estimate.","The PG10-14 Docker boot value in this catalog is 8MB while PG15-18 report 128MB, reflecting historical initdb/container defaults rather than a universal hardware recommendation. The official guidance treats about 25% of RAM as a starting point for a dedicated server and rarely expects more than 40% to help.","A larger cache changes checkpoint and WAL pressure, often requiring a larger max_wal_size, and leaves less memory for backend processes, work_mem, maintenance, extensions, and the OS. Buffer allocation uses BLCKSZ units, normally 8kB. Its postmaster context fixes the value at server start; changing it requires a restart."],"pitfalls":["Changing shared_buffers 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: shared_buffers","url":"https://www.postgresql.org/docs/19/runtime-config-resource.html#GUC-SHARED-BUFFERS"},{"title":"PostgreSQL 19 release notes","url":"https://www.postgresql.org/docs/19/release-19.html"}],"related":["effective_cache_size","work_mem","max_wal_size","huge_pages","checkpoint_completion_target","wal_buffers"],"summary":"shared_buffers — Sets the number of shared memory buffers used by the server. Observed in PG9.0–19 Beta 4; its last measured boot default is 128 MiB (16384 × 8kB) in PG19 Beta 4, with postmaster context. This is a beta-snapshot fact and can change before PostgreSQL 19 GA."},"enumvals":[],"first_version":"7.4","group":"Resource Usage","group_slug":"resource","imported_at":"2026-09-27T17:57:31.963059+08:00","intro_commit":{},"key":"shared_buffers","last_version":"20","max_val":"","min_val":"","name":"shared_buffers","position":357,"present_in":["7.4","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"],"short_desc":"Sets the amount of memory the database server uses for shared memory buffers.","short_desc_zh":"","source_rev":"english-manuals:037c09e223db9df8f87977b3a242b37a97dfe10318ad50ec287db034edb14c14","unit":"","vartype":"integer"}},"Definition":{"Collection":"guc","Key":"shared_buffers","SourceDatabase":"center","Version":"18","SourceTable":"guc","SourceKey":"shared_buffers","SourceRevision":"english-manuals:037c09e223db9df8f87977b3a242b37a97dfe10318ad50ec287db034edb14c14","Facts":{"boot_val":"16384","category":"Resource Usage / Memory","context":"postmaster","description":"Sets the amount of memory the database server uses for shared memory buffers. The default is typically 128 megabytes (128MB), but might be less if your kernel settings will not support it (as determined during initdb). This setting must be at least 128 kilobytes. However, settings significantly higher than the minimum are usually needed for good performance. If this value is specified without units, it is taken as blocks, that is BLCKSZ bytes, typically 8kB. (Non-default values of BLCKSZ change the minimum value.) This parameter can only be set at server start. If you have a dedicated database server with 1GB or more of RAM, a reasonable starting value for shared_buffers is 25% of the memory in your system. There are some workloads where even larger settings for shared_buffers are effective, but because PostgreSQL also relies on the operating system cache, it is unlikely that an allocation of more than 40% of RAM to shared_buffers will work better than a smaller amount. Larger settings for shared_buffers usually require a corresponding increase in max_wal_size, in order to spread out the process of writing large quantities of new or changed data over a longer period of time. On systems with less than 1GB of RAM, a smaller percentage of RAM is appropriate, so as to leave adequate space for the operating system.","doc":{"anchor":"GUC-SHARED-BUFFERS","file":"runtime-config-resource.html","lang":"en","sha256":"2e207c599f0884dfbe594558c478a2c7c132578981071e980e2015f31dfce28c","slug":"18"},"documented":true,"enumvals":null,"extra_desc":null,"lang":"en","max_val":"1073741823","metadata_version":"18","min_val":"16","name":"shared_buffers","short_desc":"Sets the number of shared memory buffers used by the server.","source":"pg-settings-source-snapshot","unit":"8kB","vartype":"integer"},"ManualEvidence":{"doc":{"anchor":"GUC-SHARED-BUFFERS","file":"runtime-config-resource.html","lang":"en","sha256":"2e207c599f0884dfbe594558c478a2c7c132578981071e980e2015f31dfce28c","slug":"18"}},"MeasuredEvidence":{"metadata_version":"18"}},"Text":{"Collection":"guc","Key":"shared_buffers","SourceDatabase":"center","Version":"18","Locale":"en","Title":"shared_buffers","Summary":"Sets the amount of memory the database server uses for shared memory buffers. The default is typically 128 megabytes (128MB), but might be less if your kernel settings will not support it (as determined during initdb). This setting must be at least 128 kilobytes. However, settings significantly higher than the minimum are usually needed for good performance. If this value is specified without units, it is taken as blocks, that is BLCKSZ bytes, typically 8kB. (Non-default values of BLCKSZ change the minimum value.) This parameter can only be set at server start. If you have a dedicated database server with 1GB or more of RAM, a reasonable starting value for shared_buffers is 25% of the memory in your system. There are some workloads where even larger settings for shared_buffers are effective, but because PostgreSQL also relies on the operating system cache, it is unlikely that an allocation of more than 40% of RAM to shared_buffers will work better than a smaller amount. Larger settings for shared_buffers usually require a corresponding increase in max_wal_size, in order to spread out the process of writing large quantities of new or changed data over a longer period of time. On systems with less than 1GB of RAM, a smaller percentage of RAM is appropriate, so as to leave adequate space for the operating system.","BodyHTML":"\u003cp\u003eSets the amount of memory the database server uses for shared memory buffers. The default is typically 128 megabytes (128MB), but might be less if your kernel settings will not support it (as determined during initdb). This setting must be at least 128 kilobytes. However, settings significantly higher than the minimum are usually needed for good performance. If this value is specified without units, it is taken as blocks, that is BLCKSZ bytes, typically 8kB. (Non-default values of BLCKSZ change the minimum value.) This parameter can only be set at server start. If you have a dedicated database server with 1GB or more of RAM, a reasonable starting value for shared_buffers is 25% of the memory in your system. There are some workloads where even larger settings for shared_buffers are effective, but because PostgreSQL also relies on the operating system cache, it is unlikely that an allocation of more than 40% of RAM to shared_buffers will work better than a smaller amount. Larger settings for shared_buffers usually require a corresponding increase in max_wal_size, in order to spread out the process of writing large quantities of new or changed data over a longer period of time. On systems with less than 1GB of RAM, a smaller percentage of RAM is appropriate, so as to leave adequate space for the operating system.\u003c/p\u003e","SourceRevision":"english-manuals:037c09e223db9df8f87977b3a242b37a97dfe10318ad50ec287db034edb14c14","ContentHash":"bac26e7883ee2f6e0d462415cca65188d62703eacb6e5553fee0c3f0695fdd45","Payload":{"description":"Sets the amount of memory the database server uses for shared memory buffers. The default is typically 128 megabytes (128MB), but might be less if your kernel settings will not support it (as determined during initdb). This setting must be at least 128 kilobytes. However, settings significantly higher than the minimum are usually needed for good performance. If this value is specified without units, it is taken as blocks, that is BLCKSZ bytes, typically 8kB. (Non-default values of BLCKSZ change the minimum value.) This parameter can only be set at server start. If you have a dedicated database server with 1GB or more of RAM, a reasonable starting value for shared_buffers is 25% of the memory in your system. There are some workloads where even larger settings for shared_buffers are effective, but because PostgreSQL also relies on the operating system cache, it is unlikely that an allocation of more than 40% of RAM to shared_buffers will work better than a smaller amount. Larger settings for shared_buffers usually require a corresponding increase in max_wal_size, in order to spread out the process of writing large quantities of new or changed data over a longer period of time. On systems with less than 1GB of RAM, a smaller percentage of RAM is appropriate, so as to leave adequate space for the operating system."}},"RequestedLocale":"zh-Hans","Fallback":true,"Versions":["10","11","12","13","14","15","16","17","18","19","20","7.4","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"],"Signatures":null,"Spellings":null,"SQLState":null,"Evidence":null}
