pg_backend_memory_contexts

显示附加到当前会话的服务器进程的内存上下文使用情况的视图

pg_backend_memory_contexts 是一个 系统目录 视图,显示附加到当前会话的服务器进程的内存上下文使用情况。这提供了一种可访问的方法来检查各个后端中的内存使用情况,而无需附加调试器。

pg_backend_memory_contextsPostgreSQL 14 中添加。

按 PostgreSQL 版本定义

pg_backend_memory_contexts (PostgreSQL 18)

        View "pg_catalog.pg_backend_memory_contexts"
    Column     |   Type    | Collation | Nullable | Default 
---------------+-----------+-----------+----------+---------
 name          | text      |           |          | 
 ident         | text      |           |          | 
 type          | text      |           |          | 
 level         | integer   |           |          | 
 path          | integer[] |           |          | 
 total_bytes   | bigint    |           |          | 
 total_nblocks | bigint    |           |          | 
 free_bytes    | bigint    |           |          | 
 free_chunks   | bigint    |           |          | 
 used_bytes    | bigint    |           |          |
    

文档: pg_backend_memory_contexts

pg_backend_memory_contexts (PostgreSQL 17)

       View "pg_catalog.pg_backend_memory_contexts"
    Column     |  Type   | Collation | Nullable | Default 
---------------+---------+-----------+----------+---------
 name          | text    |           |          | 
 ident         | text    |           |          | 
 parent        | text    |           |          | 
 level         | integer |           |          | 
 total_bytes   | bigint  |           |          | 
 total_nblocks | bigint  |           |          | 
 free_bytes    | bigint  |           |          | 
 free_chunks   | bigint  |           |          | 
 used_bytes    | bigint  |           |          |
    

文档: pg_backend_memory_contexts

pg_backend_memory_contexts (PostgreSQL 16)

       View "pg_catalog.pg_backend_memory_contexts"
    Column     |  Type   | Collation | Nullable | Default 
---------------+---------+-----------+----------+---------
 name          | text    |           |          | 
 ident         | text    |           |          | 
 parent        | text    |           |          | 
 level         | integer |           |          | 
 total_bytes   | bigint  |           |          | 
 total_nblocks | bigint  |           |          | 
 free_bytes    | bigint  |           |          | 
 free_chunks   | bigint  |           |          | 
 used_bytes    | bigint  |           |          |
    

文档: pg_backend_memory_contexts

pg_backend_memory_contexts (PostgreSQL 15)

       View "pg_catalog.pg_backend_memory_contexts"
    Column     |  Type   | Collation | Nullable | Default 
---------------+---------+-----------+----------+---------
 name          | text    |           |          | 
 ident         | text    |           |          | 
 parent        | text    |           |          | 
 level         | integer |           |          | 
 total_bytes   | bigint  |           |          | 
 total_nblocks | bigint  |           |          | 
 free_bytes    | bigint  |           |          | 
 free_chunks   | bigint  |           |          | 
 used_bytes    | bigint  |           |          |
    

文档: pg_backend_memory_contexts

pg_backend_memory_contexts (PostgreSQL 14)

       View "pg_catalog.pg_backend_memory_contexts"
    Column     |  Type   | Collation | Nullable | Default 
---------------+---------+-----------+----------+---------
 name          | text    |           |          | 
 ident         | text    |           |          | 
 parent        | text    |           |          | 
 level         | integer |           |          | 
 total_bytes   | bigint  |           |          | 
 total_nblocks | bigint  |           |          | 
 free_bytes    | bigint  |           |          | 
 free_chunks   | bigint  |           |          | 
 used_bytes    | bigint  |           |          |
    

文档: pg_backend_memory_contexts

更改历史

示例

postgres=# SELECT name, parent, level, total_bytes, total_nblocks, free_bytes, free_chunks, used_bytes
  FROM pg_backend_memory_contexts WHERE name != 'index info';
           name           |       parent       | level | total_bytes | total_nblocks | free_bytes | free_chunks | used_bytes 
--------------------------+--------------------+-------+-------------+---------------+------------+-------------+------------
 TopMemoryContext         |                    |     0 |       68720 |             5 |      14976 |          12 |      53744
 TopTransactionContext    | TopMemoryContext   |     1 |        8192 |             1 |       7720 |           0 |        472
 Operator lookup cache    | TopMemoryContext   |     1 |       24576 |             2 |      10712 |           4 |      13864
 Record information cache | TopMemoryContext   |     1 |        8192 |             1 |       1536 |           0 |       6656
 RowDescriptionContext    | TopMemoryContext   |     1 |        8192 |             1 |       6880 |           0 |       1312
 MessageContext           | TopMemoryContext   |     1 |       65536 |             4 |      24144 |           0 |      41392
 Operator class cache     | TopMemoryContext   |     1 |        8192 |             1 |        512 |           0 |       7680
 smgr relation table      | TopMemoryContext   |     1 |       16384 |             2 |       4544 |           3 |      11840
 TransactionAbortContext  | TopMemoryContext   |     1 |       32768 |             1 |      32504 |           0 |        264
 Portal hash              | TopMemoryContext   |     1 |        8192 |             1 |        512 |           0 |       7680
 TopPortalContext         | TopMemoryContext   |     1 |        8192 |             1 |       7648 |           0 |        544
 PortalContext            | TopPortalContext   |     2 |        1024 |             1 |        568 |           0 |        456
 ExecutorState            | PortalContext      |     3 |       49216 |             4 |      13040 |           3 |      36176
 printtup                 | ExecutorState      |     4 |        8192 |             1 |       7928 |           0 |        264
 Table function arguments | ExecutorState      |     4 |        8192 |             1 |       7872 |           0 |        320
 ExprContext              | ExecutorState      |     4 |        8192 |             1 |       3336 |           0 |       4856
 Relcache by OID          | TopMemoryContext   |     1 |       16384 |             2 |       3424 |           3 |      12960
 CacheMemoryContext       | TopMemoryContext   |     1 |      524288 |             7 |     104416 |           0 |     419872
 relation rules           | CacheMemoryContext |     2 |        8192 |             4 |        464 |           0 |       7728
 WAL record construction  | TopMemoryContext   |     1 |       49776 |             2 |       6344 |           0 |      43432
 PrivateRefCount          | TopMemoryContext   |     1 |        8192 |             1 |       2584 |           0 |       5608
 MdSmgr                   | TopMemoryContext   |     1 |        8192 |             1 |       7864 |           0 |        328
 LOCALLOCK hash           | TopMemoryContext   |     1 |        8192 |             1 |        512 |           0 |       7680
 Timezones                | TopMemoryContext   |     1 |      104128 |             2 |       2584 |           0 |     101544
 ErrorContext             | TopMemoryContext   |     1 |        8192 |             1 |       7928 |           5 |        264
(25 rows)

分类

内存PostgreSQL 内部系统目录

反馈

提交任何关于 "pg_backend_memory_contexts" 的评论、建议或更正 此处