postgresql的shared memory

本文详细介绍了PostgreSQL数据库中共享内存的使用方式及其内部结构。包括共享内存中的数据结构如hash表、缓冲池、锁表等,以及各种关键组件如PGPROC、XLOG、CLOG等的作用和工作原理。

postgresql是多进程的,这个 shared memory 就是多个进程中进行通信用的,是用共享内存实现的

在 storage/ipc/ipci.c 中的 void
CreateSharedMemoryAndSemaphores(bool makePrivate, int port) 函数中

主要包括

shmem index table 类型是 hash table

在shared memory 里面存了多个数据结构,通过名字查找该数据结构是不是已经存在,方便快速查找用的,下面的项,都在这个 hast table 中有一项

buffer pool 初始化是 8K * 4096

lock tables 类型是 hash table

PGPROC : Each backend has a PGPROC struct in shared memory

XLOG

CLOG

LWLocks

 

 

 

 

SUBTRANS

TwoPhase

MultiXact

LWLocks

 

 

SharedProcArray : Each backend has a PGPROC struct in shared memory

BackendStatus: Each live backend maintains a PgBackendStatus struct in shared memory
showing its current activity

Shared cache invalidation memory segment

PMSignalData

bgwriter-related shared memory

autovacuum-related shared memory

BTreeShmemSize

SyncScanShmemSize

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值