57.27. pg_shmem_allocations #

В представлении pg_shmem_allocations показываются блоки памяти, выделенные в основном сегменте общей памяти сервера. Сюда входят блоки, выделенные с использованием описанных в Подразделе 41.10.10 механизмов как для самого процесса Postgres Pro, так и для расширений.

Заметьте, что в этом представлении не показываются блоки, выделенные с использованием инфраструктуры динамической общей памяти.

Таблица 57.27. Столбцы pg_shmem_allocations

Тип столбца

Описание

name text

Имя блока в общей памяти. NULL, если этот блок памяти не используется, и <anonymous>, если это анонимный блок.

off int8

Смещение, с которого начинается выделенный блок. NULL, если это анонимный блок, так как дополнительной информации о таких блоках нет.

size int8

Размер блока в байтах

allocated_size int8

В размер блока в байтах включается размер выравнивающего дополнения. Для анонимных блоков информация о дополнении недоступна, поэтому значения в столбцах size и allocated_size всегда равны. Для освобождённой памяти объём дополнения не имеет смысла, так что эти столбцы тоже будут содержать одинаковые значения.


Анонимными считаются блоки, выделенные непосредственно функцией ShmemAlloc(), а не функцией ShmemInitStruct() или ShmemInitHash().

По умолчанию представление pg_shmem_allocations могут читать только суперпользователи или пользователи c правами роли pg_read_all_stats.

57.27. pg_shmem_allocations #

The pg_shmem_allocations view shows allocations made from the server's main shared memory segment. This includes both memory allocated by Postgres Pro itself and memory allocated by extensions using the mechanisms detailed in Section 41.10.10.

Note that this view does not include memory allocated using the dynamic shared memory infrastructure.

Table 57.27. pg_shmem_allocations Columns

Column Type

Description

name text

The name of the shared memory allocation. NULL for unused memory and <anonymous> for anonymous allocations.

off int8

The offset at which the allocation starts. NULL for anonymous allocations, since details related to them are not known.

size int8

Size of the allocation in bytes

allocated_size int8

Size of the allocation in bytes including padding. For anonymous allocations, no information about padding is available, so the size and allocated_size columns will always be equal. Padding is not meaningful for free memory, so the columns will be equal in that case also.


Anonymous allocations are allocations that have been made with ShmemAlloc() directly, rather than via ShmemInitStruct() or ShmemInitHash().

By default, the pg_shmem_allocations view can be read only by superusers or roles with privileges of the pg_read_all_stats role.

FAQ