1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-30 11:03:19 +03:00

Add pg_backend_memory_contexts system view.

This view displays the usages of all the memory contexts of the server
process attached to the current session. This information is useful to
investigate the cause of backend-local memory bloat.

This information can be also collected by calling
MemoryContextStats(TopMemoryContext) via a debugger. But this technique
cannot be uesd in some environments because no debugger is available there.
And it outputs lots of text messages and it's not easy to analyze them.
So, pg_backend_memory_contexts view allows us to access to backend-local
memory contexts information more easily.

Bump catalog version.

Author: Atsushi Torikoshi, Fujii Masao
Reviewed-by: Tatsuhito Kasahara, Andres Freund, Daniel Gustafsson, Robert Haas, Michael Paquier
Discussion: https://postgr.es/m/72a656e0f71d0860161e0b3f67e4d771@oss.nttdata.com
This commit is contained in:
Fujii Masao
2020-08-19 15:34:43 +09:00
parent 07f32fcd23
commit 3e98c0bafb
6 changed files with 283 additions and 1 deletions

View File

@ -9226,6 +9226,11 @@ SCRAM-SHA-256$<replaceable>&lt;iteration count&gt;</replaceable>:<replaceable>&l
<entry>available versions of extensions</entry>
</row>
<row>
<entry><link linkend="view-pg-backend-memory-contexts"><structname>pg_backend_memory_contexts</structname></link></entry>
<entry>backend memory contexts</entry>
</row>
<row>
<entry><link linkend="view-pg-config"><structname>pg_config</structname></link></entry>
<entry>compile-time configuration parameters</entry>
@ -9577,6 +9582,123 @@ SCRAM-SHA-256$<replaceable>&lt;iteration count&gt;</replaceable>:<replaceable>&l
</para>
</sect1>
<sect1 id="view-pg-backend-memory-contexts">
<title><structname>pg_backend_memory_contexts</structname></title>
<indexterm zone="view-pg-backend-memory-contexts">
<primary>pg_backend_memory_contexts</primary>
</indexterm>
<para>
The view <structname>pg_backend_memory_contexts</structname> displays all
the memory contexts of the server process attached to the current session.
</para>
<para>
<structname>pg_backend_memory_contexts</structname> contains one row
for each memory context.
</para>
<table>
<title><structname>pg_backend_memory_contexts</structname> Columns</title>
<tgroup cols="1">
<thead>
<row>
<entry role="catalog_table_entry"><para role="column_definition">
Column Type
</para>
<para>
Description
</para></entry>
</row>
</thead>
<tbody>
<row>
<entry role="catalog_table_entry"><para role="column_definition">
<structfield>name</structfield> <type>text</type>
</para>
<para>
Name of the memory context
</para></entry>
</row>
<row>
<entry role="catalog_table_entry"><para role="column_definition">
<structfield>ident</structfield> <type>text</type>
</para>
<para>
Identification information of the memory context. This field is truncated at 1024 bytes
</para></entry>
</row>
<row>
<entry role="catalog_table_entry"><para role="column_definition">
<structfield>parent</structfield> <type>text</type>
</para>
<para>
Name of the parent of this memory context
</para></entry>
</row>
<row>
<entry role="catalog_table_entry"><para role="column_definition">
<structfield>level</structfield> <type>int4</type>
</para>
<para>
Distance from TopMemoryContext in context tree
</para></entry>
</row>
<row>
<entry role="catalog_table_entry"><para role="column_definition">
<structfield>total_bytes</structfield> <type>int8</type>
</para>
<para>
Total bytes allocated for this memory context
</para></entry>
</row>
<row>
<entry role="catalog_table_entry"><para role="column_definition">
<structfield>total_nblocks</structfield> <type>int8</type>
</para>
<para>
Total number of blocks allocated for this memory context
</para></entry>
</row>
<row>
<entry role="catalog_table_entry"><para role="column_definition">
<structfield>free_bytes</structfield> <type>int8</type>
</para>
<para>
Free space in bytes
</para></entry>
</row>
<row>
<entry role="catalog_table_entry"><para role="column_definition">
<structfield>free_chunks</structfield> <type>int8</type>
</para>
<para>
Total number of free chunks
</para></entry>
</row>
<row>
<entry role="catalog_table_entry"><para role="column_definition">
<structfield>used_bytes</structfield> <type>int8</type>
</para>
<para>
Used space in bytes
</para></entry>
</row>
</tbody>
</tgroup>
</table>
</sect1>
<sect1 id="view-pg-config">
<title><structname>pg_config</structname></title>