pg_shmem_allocations 是一个 系统目录 视图,用于显示从服务器主共享内存段进行的分配。
pg_shmem_allocations 在 PostgreSQL 13 中被添加。
按 PostgreSQL 版本定义
pg_shmem_allocations (PostgreSQL 19)
View "pg_catalog.pg_shmem_allocations"
Column | Type | Collation | Nullable | Default
----------------+--------+-----------+----------+---------
name | text | | |
off | bigint | | |
size | bigint | | |
allocated_size | bigint | | |
pg_shmem_allocations (PostgreSQL 18)
View "pg_catalog.pg_shmem_allocations"
Column | Type | Collation | Nullable | Default
----------------+--------+-----------+----------+---------
name | text | | |
off | bigint | | |
size | bigint | | |
allocated_size | bigint | | |
pg_shmem_allocations (PostgreSQL 17)
View "pg_catalog.pg_shmem_allocations"
Column | Type | Collation | Nullable | Default
----------------+--------+-----------+----------+---------
name | text | | |
off | bigint | | |
size | bigint | | |
allocated_size | bigint | | |
pg_shmem_allocations (PostgreSQL 16)
View "pg_catalog.pg_shmem_allocations"
Column | Type | Collation | Nullable | Default
----------------+--------+-----------+----------+---------
name | text | | |
off | bigint | | |
size | bigint | | |
allocated_size | bigint | | |
pg_shmem_allocations (PostgreSQL 15)
View "pg_catalog.pg_shmem_allocations"
Column | Type | Collation | Nullable | Default
----------------+--------+-----------+----------+---------
name | text | | |
off | bigint | | |
size | bigint | | |
allocated_size | bigint | | |
pg_shmem_allocations (PostgreSQL 14)
View "pg_catalog.pg_shmem_allocations"
Column | Type | Collation | Nullable | Default
----------------+--------+-----------+----------+---------
name | text | | |
off | bigint | | |
size | bigint | | |
allocated_size | bigint | | |
pg_shmem_allocations (PostgreSQL 13)
View "pg_catalog.pg_shmem_allocations"
Column | Type | Collation | Nullable | Default
----------------+--------+-----------+----------+---------
name | text | | |
off | bigint | | |
size | bigint | | |
allocated_size | bigint | | |
变更历史
- PostgreSQL 15
- 可由
pg_read_all_stats的成员访问 (commit 77ea4f94)
- 可由
- PostgreSQL 13
- 添加 (commit ed10f32e)
示例
postgres=# SELECT * FROM pg_shmem_allocations WHERE name LIKE 'Backend%' ORDER BY name;
name | off | size | allocated_size
---------------------------------+-----------+--------+----------------
Backend Activity Buffer | 288185472 | 131072 | 131072
Backend Application Name Buffer | 288169088 | 8192 | 8192
Backend Client Host Name Buffer | 288177280 | 8192 | 8192
Backend SSL Status Buffer | 288316544 | 41984 | 41984
Backend Status Array | 288114816 | 54272 | 54272
(5 rows)
参考资料
- PostgreSQL documentation: pg_shmem_allocations
