Re: pg_shmem_allocations & documentation - Mailing list pgsql-hackers

From Kyotaro Horiguchi
Subject Re: pg_shmem_allocations & documentation
Date
Msg-id 20201211.110058.1671739809253771531.horikyota.ntt@gmail.com
Whole thread Raw
In response to pg_shmem_allocations & documentation  (Benoit Lobréau <benoit.lobreau@gmail.com>)
Responses Re: pg_shmem_allocations & documentation
List pgsql-hackers
At Thu, 10 Dec 2020 11:07:47 +0100, Benoit Lobréau <benoit.lobreau@gmail.com> wrote in
> Hi,
>
> While reading the documentation of pg_shmem_allocations, I noticed that the
> off column is described as such :
>
> "The offset at which the allocation starts. NULL for anonymous allocations
> and unused memory."
>
> Whereas, the view returns a value for unused memory:
>
> [local]:5433 postgres@postgres=# SELECT * FROM pg_shmem_allocations WHERE
> name IS NULL;
>  name |    off    |  size   | allocated_size
> ------+-----------+---------+----------------
>  ¤    | 178095232 | 1923968 |        1923968
> (1 row)
>
> From what I understand, the doc is wrong.
> Am I right ?

Good catch! I think you're right.  It seems to me the conclusion in
the discussion is to expose the offset for free memory.

Although we could just rip some words off, I'd like to propose instead
to add an explanation why it is not exposed for anonymous allocations,
like the column allocated_size.

> Benoit
>
> [1] https://www.postgresql.org/docs/13/view-pg-shmem-allocations.html
> [2]
> https://www.postgresql.org/message-id/flat/20140504114417.GM12715%40awork2.anarazel.de
> (original thread)

regards.
¤
--
Kyotaro Horiguchi
NTT Open Source Software Center
diff --git a/doc/src/sgml/catalogs.sgml b/doc/src/sgml/catalogs.sgml
index 62711ee83f..8921907f5e 100644
--- a/doc/src/sgml/catalogs.sgml
+++ b/doc/src/sgml/catalogs.sgml
@@ -12492,8 +12492,9 @@ SELECT * FROM pg_locks pl LEFT JOIN pg_prepared_xacts ppx
        <structfield>off</structfield> <type>int8</type>
       </para>
       <para>
-       The offset at which the allocation starts. NULL for anonymous
-       allocations and unused memory.
+       The offset at which the allocation starts. For anonymous allocations,
+       no information about individual allocations is available, so the column
+       will be NULL in that case.
       </para></entry>
      </row>


pgsql-hackers by date:

Previous
From: Bharath Rupireddy
Date:
Subject: Re: Fail Fast In CTAS/CMV If Relation Already Exists To Avoid Unnecessary Rewrite, Planning Costs
Next
From: Thomas Munro
Date:
Subject: Re: Autovacuum worker doesn't immediately exit on postmaster death