postgresql 12 新增参数 shared_memory_type

os: centos 7.6
db: oracle 19.3

postgresql 12 新增参数 shared_memory_type ,但同时又涉及到 dynamic_shared_memory_type 参数,需要了解下这两个参数

postgresql.conf 文件

#shared_memory_type = mmap		# the default is the first option
					# supported by the operating system:
					#   mmap
					#   sysv
					#   windows
					# (change requires restart)
dynamic_shared_memory_type = posix	# the default is the first option
					# supported by the operating system:
					#   posix
					#   sysv
					#   windows
					#   mmap
					# (change requires restart)

shared_memory_type (enum)

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).

查看 pgsql 12 的对这个参数的描述
Add server variable to control the type of shared memory to use (Andres Freund)
The variable is shared_memory_type. Its purpose is to allow selection of System V shared memory, if desired.

dynamic_shared_memory_type (enum)

Specifies the dynamic shared memory implementation that the server should use. Possible values are
posix (for POSIX shared memory allocated using shm_open),
sysv (for System V shared memory allocated via shmget),
windows (for Windows shared memory), and
mmap (to simulate shared memory using memory-mapped files stored in the data directory).
Not all values are supported on all platforms; the first supported option is the default for that platform.
The use of the mmap option, which is not the default on any platform, is generally discouraged because the operating system may write modified pages back to disk repeatedly, increasing system I/O load;
however, it may be useful for debugging, when the pg_dynshmem directory is stored on a RAM disk, or when other shared memory facilities are not available.

对于参数 dynamic_shared_memory_type ,已经不允许设置为 none 了.

Remove the ability to disable dynamic shared memory (Kyotaro Horiguchi)
Specifically, dynamic_shared_memory_type can no longer be set to none.


这两个参数都涉及到 os shared memory,需要好好读下 postgresql 帮助文档的 Shared Memory and Semaphores 章节.

有个疑问,shared_memory_type 为什么没有 posix 选项.

参考:
https://www.postgresql.org/docs/12/release-12.html
https://www.postgresql.org/docs/12/runtime-config-resource.html#GUC-SHARED-MEMORY-TYPE
https://www.postgresql.org/docs/12/kernel-resources.html#SYSVIPC

猜你喜欢

转载自blog.csdn.net/ctypyb2002/article/details/93724118