Introduce pg_shmem_allocations_numa view
authorTomas Vondra <tomas.vondra@postgresql.org>
Mon, 7 Apr 2025 20:54:49 +0000 (22:54 +0200)
committerTomas Vondra <tomas.vondra@postgresql.org>
Mon, 7 Apr 2025 21:08:17 +0000 (23:08 +0200)
commit8cc139bec34a2971b0682a04eb52ce7b3f5bb425
tree67e2f302199d1ac5fe406961ccd5fe47f469bdf9
parent65c298f61fc70f2f960437c05649f71b862e2c48
Introduce pg_shmem_allocations_numa view

Introduce new pg_shmem_alloctions_numa view with information about how
shared memory is distributed across NUMA nodes. For each shared memory
segment, the view returns one row for each NUMA node backing it, with
the total amount of memory allocated from that node.

The view may be relatively expensive, especially when executed for the
first time in a backend, as it has to touch all memory pages to get
reliable information about the NUMA node. This may also force allocation
of the shared memory.

Unlike pg_shmem_allocations, the view does not show anonymous shared
memory allocations. It also does not show memory allocated using the
dynamic shared memory infrastructure.

Author: Jakub Wartak <jakub.wartak@enterprisedb.com>
Reviewed-by: Andres Freund <andres@anarazel.de>
Reviewed-by: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Reviewed-by: Tomas Vondra <tomas@vondra.me>
Discussion: https://postgr.es/m/CAKZiRmxh6KWo0aqRqvmcoaX2jUxZYb4kGp3N%3Dq1w%2BDiH-696Xw%40mail.gmail.com
12 files changed:
doc/src/sgml/system-views.sgml
src/backend/catalog/system_views.sql
src/backend/storage/ipc/shmem.c
src/include/catalog/catversion.h
src/include/catalog/pg_proc.dat
src/test/regress/expected/numa.out [new file with mode: 0644]
src/test/regress/expected/numa_1.out [new file with mode: 0644]
src/test/regress/expected/privileges.out
src/test/regress/expected/rules.out
src/test/regress/parallel_schedule
src/test/regress/sql/numa.sql [new file with mode: 0644]
src/test/regress/sql/privileges.sql