{"Entry":{"collection":"guc","key":"shared_memory_type","name":"shared_memory_type","aliases":[],"metadata":{"baseline":false,"boot_human":"Not specified","boot_val":null,"category":"Resource Usage / Memory","category_zh":"","changed_in":[],"changes":[{"documentation_changed":false,"fields":{},"from":"11","status":"added","to":"12"},{"documentation_changed":true,"fields":{},"from":"12","status":"changed","to":"13"},{"documentation_changed":true,"fields":{},"from":"13","status":"changed","to":"14"},{"documentation_changed":true,"fields":{},"from":"16","status":"changed","to":"17"}],"content_hash":"3e40403dc191c2849f97e6a496c68040f22cf3c95f170e54c38f98c79f133119","context":"","default_changed_in":[],"default_history":[{"from":"12","to":"19","value":"mmap"}],"derived_content_hash":"3286ba5a3e3a3518b592cdbfd5c10843393fc9d02c4577a6be733a59d1afd9a5","editorial":{"advice":{"olap":"Large shared_buffers increases the importance of reliable main-region allocation, but workload label does not select the API. Validate startup, huge pages, failover, and service limits on the target operating system rather than benchmarking storage throughput.","oltp":"Keep the first supported platform default; on Linux that is normally mmap and is required for PostgreSQL's explicit huge-page support. Use sysv only for a verified compatibility need and provision its kernel limits before restart.","small":"Keep the platform default. Changing the implementation does not reduce the configured shared-memory size and can add kernel-limit or portability failures."},"mechanism":["shared_memory_type selects the operating-system mechanism for PostgreSQL's main shared-memory region, including shared_buffers and other fixed shared state. It does not set the region's size.","Supported enum values and the first-supported boot default are platform dependent. The Docker/Linux catalog reports mmap; Windows has its own implementation, and sysv can require nondefault kernel limits for large allocations.","On Linux, explicit huge_pages support requires mmap. This parameter is distinct from dynamic_shared_memory_type, which governs temporary dynamic segments used by parallel query and extensions. Its postmaster context fixes the value at server start; changing it requires a restart."],"pitfalls":["Treating the Linux-Docker mmap boot value as a portable default for every operating system.","Selecting sysv without raising the System V shared-memory kernel limits needed for the main region.","Forgetting that explicit huge pages on Linux require shared_memory_type=mmap.","Expecting the parameter to resize shared_buffers or other shared allocations."],"references":[{"title":"PostgreSQL 19 Beta 4: shared_memory_type","url":"https://www.postgresql.org/docs/19/runtime-config-resource.html#GUC-SHARED-MEMORY-TYPE"},{"title":"PostgreSQL 19 release notes","url":"https://www.postgresql.org/docs/19/release-19.html"}],"related":["dynamic_shared_memory_type","shared_buffers","huge_pages","huge_page_size","min_dynamic_shared_memory"],"summary":"shared_memory_type — Selects the shared memory implementation used for the main shared memory region. Observed in PG12–19 Beta 4; its last measured boot default is mmap in PG19 Beta 4, with postmaster context. This is a beta-snapshot fact and can change before PostgreSQL 19 GA."},"enumvals":[],"first_version":"12","group":"Resource Usage","group_slug":"resource","imported_at":"2026-09-27T17:57:31.972777+08:00","intro_commit":{"authored_at":"2019-02-03T09:55:39+01:00","discussion":["https://postgr.es/m/HE1PR0202MB28126DB4E0B6621CC6A1A91286D90%40HE1PR0202MB2812.eurprd02.prod.outlook.com","https://postgr.es/m/2AE143D2-87D3-4AD1-AC78-CE2258230C05%40FreeBSD.org"],"hash":"f1bebef60ec8f557324cd3bfc1671da1318de968","subject":"Add shared_memory_type GUC.","url":"https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=f1bebef60ec8f557324cd3bfc1671da1318de968"},"key":"shared_memory_type","last_version":"20","max_val":"","min_val":"","name":"shared_memory_type","position":360,"present_in":["12","13","14","15","16","17","18","19","20"],"repair_provenance":{"original_source_revision":"english-manuals:a7d58622efa4f0ba0a79ad27f3d2a2662a32fb6f117204440d2d44b463f71b77","receipt_sha256":"dd63244b84469eb32c3488d51d145db9558be3e955ad7949abafab7775277844","repair":"wiki-repair-20261023"},"short_desc":"Specifies the shared memory implementation that the server should use for the main shared memory region that holds PostgreSQL's shared buffers and other shared data.","short_desc_zh":"","source_rev":"wiki-repair-20261023:b2d4464800014e8800948636e483693868020b457858dc20715b0deef7468f7f","unit":"","vartype":"enum"}},"Definition":{"Collection":"guc","Key":"shared_memory_type","SourceDatabase":"center","Version":"18","SourceTable":"guc","SourceKey":"shared_memory_type","SourceRevision":"wiki-repair-20261023:b2d4464800014e8800948636e483693868020b457858dc20715b0deef7468f7f","Facts":{"boot_val":"mmap","category":"Resource Usage / Memory","context":"postmaster","description":"Specifies the shared memory implementation that the server should use for the main shared memory region that holds PostgreSQL's shared buffers and other shared data. Possible values are mmap (for anonymous shared memory allocated using mmap), sysv (for System V shared memory allocated via shmget) and windows (for Windows shared memory). Not all values are supported on all platforms; the first supported option is the default for that platform. The use of the sysv option, which is not the default on any platform, is generally discouraged because it typically requires non-default kernel settings to allow for large allocations (see Section 18.4.1). This parameter can only be set at server start.","description_zh":"指定服务器用于主共享内存区域的共享内存实现，该区域存放 PostgreSQL 的共享缓冲区及其他共享数据。可选值为 mmap（使用 mmap 分配的匿名共享内存）、sysv（通过 shmget 分配的 System V 共享内存）和 windows（Windows 共享内存）。并非所有平台都支持所有值；第一个受支持的选项是该平台的默认值。sysv 不是任何平台的默认选项，通常不建议使用，因为它一般需要更改内核的默认设置才能分配大量内存（见第 18.4.1 节）。此参数只能在服务器启动时设置。","description_zh_html":"\u003cp\u003e\n        指定服务器用于主共享内存区域的共享内存实现，该区域存放 \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e 的共享缓冲区及其他共享数据。可选值为 \u003ccode class=\"literal\"\u003emmap\u003c/code\u003e（使用 \u003ccode class=\"function\"\u003emmap\u003c/code\u003e 分配的匿名共享内存）、\u003ccode class=\"literal\"\u003esysv\u003c/code\u003e（通过 \u003ccode class=\"function\"\u003eshmget\u003c/code\u003e 分配的 System V 共享内存）和 \u003ccode class=\"literal\"\u003ewindows\u003c/code\u003e（Windows 共享内存）。并非所有平台都支持所有值；第一个受支持的选项是该平台的默认值。\u003ccode class=\"literal\"\u003esysv\u003c/code\u003e 不是任何平台的默认选项，通常不建议使用，因为它一般需要更改内核的默认设置才能分配大量内存（见\u003ca class=\"xref\" href=\"/zh/docs/18/kernel-resources.html#SYSVIPC\" title=\"18.4.1. 共享内存和信号量\"\u003e第 18.4.1 节\u003c/a\u003e）。此参数只能在服务器启动时设置。\n       \u003c/p\u003e","doc":{"anchor":"GUC-SHARED-MEMORY-TYPE","file":"runtime-config-resource.html","lang":"en","sha256":"2e207c599f0884dfbe594558c478a2c7c132578981071e980e2015f31dfce28c","slug":"18"},"documented":true,"enumvals":["sysv","mmap"],"extra_desc":null,"lang":"en","max_val":null,"metadata_version":"18","min_val":null,"name":"shared_memory_type","short_desc":"Selects the shared memory implementation used for the main shared memory region.","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":"enum","zh_from":"same-version-pgdoc"},"ManualEvidence":{"doc":{"anchor":"GUC-SHARED-MEMORY-TYPE","file":"runtime-config-resource.html","lang":"en","sha256":"2e207c599f0884dfbe594558c478a2c7c132578981071e980e2015f31dfce28c","slug":"18"}},"MeasuredEvidence":{"metadata_version":"18"}},"Text":{"Collection":"guc","Key":"shared_memory_type","SourceDatabase":"center","Version":"18","Locale":"en","Title":"shared_memory_type","Summary":"Specifies the shared memory implementation that the server should use for the main shared memory region that holds PostgreSQL's shared buffers and other shared data. Possible values are mmap (for anonymous shared memory allocated using mmap), sysv (for System V shared memory allocated via shmget) and windows (for Windows shared memory). Not all values are supported on all platforms; the first supported option is the default for that platform. The use of the sysv option, which is not the default on any platform, is generally discouraged because it typically requires non-default kernel settings to allow for large allocations (see Section 18.4.1). This parameter can only be set at server start.","BodyHTML":"\u003cp\u003eSpecifies the shared memory implementation that the server should use for the main shared memory region that holds PostgreSQL\u0026#39;s shared buffers and other shared data. Possible values are mmap (for anonymous shared memory allocated using mmap), sysv (for System V shared memory allocated via shmget) and windows (for Windows shared memory). Not all values are supported on all platforms; the first supported option is the default for that platform. The use of the sysv option, which is not the default on any platform, is generally discouraged because it typically requires non-default kernel settings to allow for large allocations (see Section 18.4.1). This parameter can only be set at server start.\u003c/p\u003e","SourceRevision":"wiki-repair-20261023:b2d4464800014e8800948636e483693868020b457858dc20715b0deef7468f7f","ContentHash":"40f2f28a8e1886f540d00052228cb3c9ce9fe10c4c9b7faeae832d2237d2f551","Payload":{"description":"Specifies the shared memory implementation that the server should use for the main shared memory region that holds PostgreSQL's shared buffers and other shared data. Possible values are mmap (for anonymous shared memory allocated using mmap), sysv (for System V shared memory allocated via shmget) and windows (for Windows shared memory). Not all values are supported on all platforms; the first supported option is the default for that platform. The use of the sysv option, which is not the default on any platform, is generally discouraged because it typically requires non-default kernel settings to allow for large allocations (see Section 18.4.1). This parameter can only be set at server start."}},"RequestedLocale":"en","Fallback":false,"Versions":["12","13","14","15","16","17","18","19","20"],"Locales":["en","zh-Hans"],"Signatures":null,"Spellings":null,"SQLState":null,"Evidence":null}
