商派商城网站建设方案,菏泽+网站建设公司,淘宝网页制作,公司介绍模板ppt一、进程及内存架构 PostgreSQL 数据库运行时#xff0c;使用如下命令可查询数据库进程#xff0c;正对应上述结构图。
[postgreslocalhost ~]$ ps -ef|grep post
postgres 8649 1 0 15:05 ? 00:00:00 /app/pg13/bin/postgres -D /data/pg13/data
postgres …一、进程及内存架构 PostgreSQL 数据库运行时使用如下命令可查询数据库进程正对应上述结构图。
[postgreslocalhost ~]$ ps -ef|grep post
postgres 8649 1 0 15:05 ? 00:00:00 /app/pg13/bin/postgres -D /data/pg13/data
postgres 8657 8649 0 15:05 ? 00:00:00 postgres: logger
postgres 8659 8649 0 15:05 ? 00:00:00 postgres: checkpointer
postgres 8660 8649 0 15:05 ? 00:00:00 postgres: background writer
postgres 8661 8649 0 15:05 ? 00:00:00 postgres: walwriter
postgres 8662 8649 0 15:05 ? 00:00:00 postgres: autovacuum launcher
postgres 8663 8649 0 15:05 ? 00:00:00 postgres: archiver last was 0000000100000003000000CD
postgres 8664 8649 0 15:05 ? 00:00:00 postgres: stats collector
postgres 8666 8649 0 15:05 ? 00:00:00 postgres: logical replication launcher
postgres 10188 8649 0 16:19 ? 00:00:00 postgres: postgres postgres 192.168.100.1(53966) idle
postgres 10234 8649 0 16:20 ? 00:00:00 postgres: syd postgres [local] idle[postgreslocalhost ~]$ ll /app/pg13/bin/postgres
-rwxr-xr-x 1 postgres postgres 8389568 Jun 30 2022 /app/pg13/bin/postgres
[postgreslocalhost ~]$
[postgreslocalhost ~]$ ll /app/pg13/bin/postmaster
lrwxrwxrwx 1 postgres postgres 8 Jun 30 2022 /app/pg13/bin/postmaster - postgres二、进程说明
postmaster 进程数据库主进程如上所示postmaster 是个软连接对应 postgres 进程为历史版本兼容仍保留 postmaster 写法该进程可用于启停数据库pg_ctl 封装的 postgres 命令创建fork客户端连接用的子进程。logger 进程日志进程只有在参数 logging_collect 设置为 on 时才会启动 logger 辅助进程。checkpointer 进程检查点进程辅助 background write 进行内存中脏数据块的写入并且记录已经写入的脏块从而保证下次只会写入新的脏块。background writer 进程数据写入进程将共享内存中的脏数据块写入到磁盘上。walwriter 进程wal 日志写进程修改的数据记录到 wal 日志中。autovacuum launcher 进程自动清理进程自动清理被标记为删除状态的数据自动清理 MVCC 多版本产生的死元组。archiver 进程归档进程将 wal 日志在覆盖使用前备份出来。stats collector 进程统计数据收集进程主要作用就是数据的统计收集比如在一个表上进行了多少次的插入、更新和删除操作磁盘块的读写次数、行的读写次数等等。logical replication launcher 进程逻辑复制进程订阅者通过 logical replication launcher 进程向发布者订阅表的更新并获取更新。postgres 进程postmaster 创建出的客户端连接子进程。
三、内存说明
3.1 共享内存 PostgreSQL 启动后会生成一块共享内存共享内存主要用作数据块的缓冲区以便提高读写性能。WAL 日志缓冲区 和 CLOGCommitLog缓冲区也存在于共享内存中。除此以外一些全局信息也保存在共享内存中如进程信息、锁的信息、全局统计信息等相关数据库参数如下
shared_buffers一个合理开始值是系统内存的 25%设置的太大效果可能并不总是理想的因为 PostgreSQL 同样依赖操作系统的高速缓冲区默认值为 128MB。
3.2 本地内存 后台服务进程除访问共享内存以外还会申请分配一些本地内存以便暂存一些不需要全局存储的数据相关数据库参数如下
temp_buffers为每个数据库会话设置用于临时缓冲区的最大内存用于访问临时表的本地缓冲区默认值为 8MB。work_mem设置在写入临时磁盘文件之前每个查询操作(排序或哈希表)可使用的基础最大内存容量默认值是 4MB。maintenance_work_mem指定在维护性操作例如VACUUM、CREATE INDEX和ALTER TABLE ADD FOREIGN KEY中使用的最大的内存量默认值是 64MB。
PostgreSql 逻辑结构https://xiaosonggong.blog.csdn.net/article/details/131452022 PostgreSql 文件目录结构https://xiaosonggong.blog.csdn.net/article/details/120303380