Re: Add pg_stat_kind_info system view

From: Sami Imseih <samimseih(at)gmail(dot)com>
To: Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>
Cc: Michael Paquier <michael(at)paquier(dot)xyz>, Tristan Partin <tristan(at)partin(dot)io>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Add pg_stat_kind_info system view
Date: 2026-07-01 17:21:39
Message-ID: CAA5RZ0tcXN+isSJGYgHGY03g58PqU+MYo-GSfDnvKupiX7r1fw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> On Wed, Jul 01, 2026 at 04:07:06PM +0900, Michael Paquier wrote:
> > On Tue, Jun 30, 2026 at 11:17:29PM -0500, Sami Imseih wrote:
> > >>> IMO, in this case, NULL should be a synonym of "I don't know", which
> > >>> is what entry_count set to false means. 0 means "I know, there is no
> > >>> data". I'd be OK with dropping the part about fixed-sized stats where
> > >>> we enforce 1, and use NULL instead, though.
> > >>
> > >> +1, that's also my opinion [1].
> > >
> > > I'm ok with that if others feel this is better.
> >
> > Okay, thanks. Let's do so then. Let's also invent a new
> > pgstat_kind.c in activity/.
> >
> > I have been chewing a bit on the comments from Sami, leading to the
> > following result:
> > - Switched shared_size to entry_size, for consistency with
> > entry_count, but I don't agree about the use of shared_data_len.
> > shared_size is more adapted to me because it has the entry overhead
> > and the shmem entry header. That's more precise and one does not need
> > to guess the header size.

It still does not include PgStatShared_HashEntry which is 40-bytes per entry,
so it could add up if someone is calculating total consumption by a kind as
number_of_entries * size_of_entry. So that should also be accounted for, right?

But also, because this will be used to calculate consumption, we
should add a note in
the documentation to differentiate between live storage usage vs the
DSA footprint,
which will not be shrunk when entries are deleted. Someone may be confused
that their entries are much lower after deleting entries, but their memory
footprint is still high because the OS does not reclaim the free'd space.
What do you think?

--
Sami

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Masahiko Sawada 2026-07-01 17:30:30 Re: Macro redefinition warning after aeb07c55fab5c17a600b77ffcdc3b71425d6a8e7
Previous Message Ashutosh Bapat 2026-07-01 16:56:14 Re: Wrong query result w/ propgraph single lateral col reference