Hi, On Tue, Apr 08, 2025 at 12:46:16PM +0200, Tomas Vondra wrote: > > > On 4/8/25 01:26, Shinoda, Noriyoshi (SXD Japan FSI) wrote: > > Hi, > > > > Thanks for developing this great feature. > > The manual says that the 'size' column of the pg_shmem_allocations_numa > > view is 'int4', but the implementation is 'int8'. > > The attached small patch fixes the manual. > > > > Thank you for noticing this and for the fix! Pushed. > > This also reminded me we agreed to change page_num to bigint, which I > forgot to change before commit. So I adjusted that too, separately.
I was doing some extra testing and just realized (did not think of it during the review) that maybe we could add a pg_buffercache_numa usage example (like it's already done for pg_buffercache). That might sound obvious but OTOH I think that would not hurt. Something like in the attached? Regards, -- Bertrand Drouvot PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com
>From c22533a6c8a8526b75a95ccf0eb39b5d10cca1f2 Mon Sep 17 00:00:00 2001 From: Bertrand Drouvot <bertranddrouvot...@gmail.com> Date: Wed, 9 Apr 2025 18:11:28 +0000 Subject: [PATCH v1] Add pg_buffercache_numa usage example Add a query showing pg_buffercache_numa usage. --- doc/src/sgml/pgbuffercache.sgml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/doc/src/sgml/pgbuffercache.sgml b/doc/src/sgml/pgbuffercache.sgml index 537d6014942..86846830e48 100644 --- a/doc/src/sgml/pgbuffercache.sgml +++ b/doc/src/sgml/pgbuffercache.sgml @@ -550,6 +550,30 @@ regression=# SELECT n.nspname, c.relname, count(*) AS buffers public | spgist_text_tbl | 182 (10 rows) +regression=# SELECT n.nspname, c.relname, m.numa_node, count(*) AS buffers + FROM pg_buffercache b JOIN pg_class c + ON b.relfilenode = pg_relation_filenode(c.oid) AND + b.reldatabase IN (0, (SELECT oid FROM pg_database + WHERE datname = current_database())) + JOIN pg_namespace n ON n.oid = c.relnamespace + JOIN pg_buffercache_numa m ON b.bufferid = m.bufferid + GROUP BY n.nspname, c.relname, m.numa_node + ORDER BY 4 DESC + LIMIT 10; + + nspname | relname | numa_node | buffers +------------+------------------------+-----------+--------- + public | delete_test_table_pkey | 1 | 395 + public | delete_test_table | 0 | 367 + pg_catalog | pg_attribute | 0 | 306 + pg_catalog | pg_attribute | 1 | 273 + public | delete_test_table | 1 | 228 + pg_catalog | pg_largeobject | 0 | 193 + public | tenk1 | 1 | 188 + public | gin_test_idx | 1 | 187 + public | quad_poly_tbl | 1 | 182 + public | tenk2 | 0 | 176 +(10 rows) regression=# SELECT * FROM pg_buffercache_summary(); buffers_used | buffers_unused | buffers_dirty | buffers_pinned | usagecount_avg -- 2.34.1