バージョンごとのドキュメント一覧

53.5. pg_backend_memory_contexts #

The view <structname>pg_backend_memory_contexts</structname> displays all the memory contexts of the server process attached to the current session. pg_backend_memory_contextsビューは、現在のセッションにアタッチされているサーバプロセスのすべてのメモリコンテキストを表示します。

<structname>pg_backend_memory_contexts</structname> contains one row for each memory context. pg_backend_memory_contextsの各1行が各々のメモリコンテキストを格納します。

表53.5 pg_backend_memory_contexts Columns

Column Type 列 型

Description 説明

name text

Name of the memory context メモリコンテキストの名前

ident text

Identification information of the memory context. This field is truncated at 1024 bytes メモリコンテキストの識別情報。このフィールドは1024バイトで切り捨てられる

type text

Type of the memory context 《マッチ度[61.538462]》メモリコンテキストの名前 《機械翻訳》メモリコンテキストのタイプ。

level int4

The 1-based level of the context in the memory context hierarchy. The level of a context also shows the position of that context in the <structfield>path</structfield> column. 《機械翻訳》レベル階層におけるコンテキストの1から始まるメモリコンテキスト。 コンテキストのレベルは、pathカラム内のそのコンテキストの位置も示します。

path int4[]

Array of transient numerical identifiers to describe the memory context hierarchy. The first element is for <literal>TopMemoryContext</literal>, subsequent elements contain intermediate parents and the final element contains the identifier for the current context. 《機械翻訳》配列階層を記述する一時的な数値識別子のメモリコンテキスト。 最初の要素はTopMemoryContextのためのもので、後続の要素には中間の親が含まれ、最後の要素包含は現在識別子のコンテキストです。

total_bytes int8

Total bytes allocated for this memory context このメモリコンテキストで確保した合計バイト数

total_nblocks int8

Total number of blocks allocated for this memory context このメモリコンテキストで確保した合計ブロック数

free_bytes int8

Free space in bytes バイト単位の空き領域

free_chunks int8

Total number of free chunks 空きチャンクの数

used_bytes int8

Used space in bytes バイト単位の使用領域


By default, the <structname>pg_backend_memory_contexts</structname> view can be read only by superusers or roles with the privileges of the <literal>pg_read_all_stats</literal> role. デフォルトではpg_backend_memory_contextsビューはスーパーユーザか、pg_read_all_statsロールの権限を持つユーザのみが読み取り専用でアクセスできます。

Since memory contexts are created and destroyed during the running of a query, the identifiers stored in the <structfield>path</structfield> column can be unstable between multiple invocations of the view in the same query. The example below demonstrates an effective usage of this column and calculates the total number of bytes used by <literal>CacheMemoryContext</literal> and all of its children: 《機械翻訳》メモリ・コンテキストは問い合わせの実行中に作成および破棄されるため、パスカラムに格納された識別子は、同じ問い合わせのビューのマルチプル起動間で不安定になる可能性があります。 次の例は、このカラムの効果的な使用方法を示し、CacheMemoryContextおよびそのすべての子によって使用される合計バイト数を計算します。

WITH memory_contexts AS (
    SELECT * FROM pg_backend_memory_contexts
)
SELECT sum(c1.total_bytes)
FROM memory_contexts c1, memory_contexts c2
WHERE c2.name = 'CacheMemoryContext'
AND c1.path[c2.level] = c2.path[c2.level];

The <link linkend="queries-with">Common Table Expression</link> is used to ensure the context IDs in the <structfield>path</structfield> column match between both evaluations of the view. 《機械翻訳》共通テーブル式は、コンテキストの両方の評価の間でpathカラムマッチのビューIDを保証するために使用されます。