Postgresql相关的内存设置参数

关于PostgreSQL有六个主要的参数设置。
第一:share_buffers
第二:temp_buffers
第三:max_prepared_transactions
第四:work_mem
第五:maintenance_work_mem
第六:max_stack_depth

share_buffers
Sets the number of shared memory buffers used by the database server.
该参数主要是跟操作系统的共享内存有关,简单的说,就是不要超过物理内存的总量。
相关操作系统的(linux)下,使用 cat /etc/sysctl.conf 命令后,查看两个属性kernel.shmall和kernel.shmmax

temp_buffers
Sets the maximum number of temporary buffers used by each database session.
这个参数很简单,就是设置连接数据库的session大小。

max_prepared_transactions
Sets the maximum number of transactions that can be in the "prepared" state simultaneously.
这个参数与设置的事务提交有关,有很高的可靠性。

work_mem
Specifies the amount of memory to be used by internal sort operations and hash tables before switching to temporary disk files.Sort operations are used for ORDER BY、distinct、and merge joins、Hash tables are used in hash joins,hash-bse aggregation,and hash-based processing of IN subqueries.
Also, serveral running sessions could be doing such operations concurrently.So the total memory used could be many times the value of work_mem.
这个参数主要用于查询条件带排序的,或者是hash表等相关的操作。work_mem是一个连接session独享的,不是多个连接session共享的。

maintenance_work_mem
Specifies the maximum amount of memory to be used in maintenance operations,such as VACUUM,CREATE INDEX, and ALTER TABLE ADD FOREIGN KEY.
该参数主要是一个database session在执行相关操作时所需要的空间容量。

max_stack_depth
Specifies the maximum safe depth of the server's execution stack.

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值