Re: Add pg_stat_kind_info system view

Michael Paquier <michael@paquier.xyz>

From: Michael Paquier <michael@paquier.xyz>
To: Sami Imseih <samimseih@gmail.com>
Cc: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>, Tristan Partin <tristan@partin.io>, pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2026-07-01T21:28:11Z
Lists: pgsql-hackers
On Wed, Jul 01, 2026 at 12:21:39PM -0500, Sami Imseih wrote:
> 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?

Right.  I forgot about this part.  HashEntry stands on top of the
PgStatShared_* structures.

> 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?

Hmm.  I am not completely sure which way is best here.  So, I think
that I am just going to drop this field for now (entry_size as of
latest patch), and keep the rest of the patch.  It's still useful to
me, and we could always add one or more memory-related field later as
we feel in this release cycle.
--
Michael

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Add system view pg_stat_kind_info

  2. Introduce pluggable APIs for Cumulative Statistics