Home Explore Blog CI



postgresql

45th chunk of `doc/src/sgml/system-views.sgml`
efaf3b3672ad32d0a5a4e31a13280464dce32b992250f6110000000100000fa3
 allocation in bytes including padding. For anonymous
       allocations, no information about padding is available, so the
       <literal>size</literal> and <literal>allocated_size</literal> columns
       will always be equal. Padding is not meaningful for free memory, so
       the columns will be equal in that case also.
      </para></entry>
     </row>
    </tbody>
   </tgroup>
  </table>

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

  <para>
   By default, the <structname>pg_shmem_allocations</structname> view can be
   read only by superusers or roles with privileges of the
   <literal>pg_read_all_stats</literal> role.
  </para>
 </sect1>

 <sect1 id="view-pg-shmem-allocations-numa">
  <title><structname>pg_shmem_allocations_numa</structname></title>

  <indexterm zone="view-pg-shmem-allocations-numa">
   <primary>pg_shmem_allocations_numa</primary>
  </indexterm>

  <para>
   The <structname>pg_shmem_allocations_numa</structname> shows how shared
   memory allocations in the server's main shared memory segment are distributed
   across NUMA nodes. This includes both memory allocated by
   <productname>PostgreSQL</productname> itself and memory allocated
   by extensions using the mechanisms detailed in
   <xref linkend="xfunc-shared-addin" />. This view will output multiple rows
   for each of the shared memory segments provided that they are spread across
   multiple NUMA nodes. This view should not be queried by monitoring systems
   as it is very slow and may end up allocating shared memory in case it was not
   used earlier.
   Current limitation for this view is that won't show anonymous shared memory
   allocations.
  </para>

  <para>
   Note that this view does not include memory allocated using the dynamic
   shared memory infrastructure.
  </para>

  <warning>
    <para>
      When determining the <acronym>NUMA</acronym> node, the view touches
      all memory pages for the shared memory segment. This will force
      allocation of the shared memory, if it wasn't allocated already,
      and the memory may get allocated in a single <acronym>NUMA</acronym>
      node (depending on system configuration).
    </para>
  </warning>

  <table>
   <title><structname>pg_shmem_allocations_numa</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>
       The name of the shared memory allocation.
      </para></entry>
     </row>

     <row>
      <entry role="catalog_table_entry"><para role="column_definition">
       <structfield>numa_node</structfield> <type>int4</type>
      </para>
      <para>
      ID of <acronym>NUMA</acronym> node
      </para></entry>
     </row>

     <row>
      <entry role="catalog_table_entry"><para role="column_definition">
       <structfield>size</structfield> <type>int8</type>
      </para>
      <para>
       Size of the allocation on this particular NUMA memory node in bytes
      </para></entry>
     </row>

    </tbody>
   </tgroup>
  </table>

  <para>
   By default, the <structname>pg_shmem_allocations_numa</structname> view can be
   read only by superusers or roles with privileges of the
   <literal>pg_read_all_stats</literal> role.
  </para>
 </sect1>

 <sect1 id="view-pg-stats">
  <title><structname>pg_stats</structname></title>

  <indexterm zone="view-pg-stats">
   <primary>pg_stats</primary>
  </indexterm>

  <para>
   The view <structname>pg_stats</structname> provides access to
   the information stored in the <link

Title: pg_shmem_allocations_numa View
Summary
The pg_shmem_allocations_numa view in PostgreSQL displays how shared memory allocations are distributed across NUMA nodes, including memory allocated by PostgreSQL and extensions, showing details such as allocation name, NUMA node ID, and size, but excluding anonymous shared memory allocations and memory allocated using dynamic shared memory infrastructure.