Re: pgstat: allow a stats kind to use its own dedicated dsa/dshash - Mailing list pgsql-hackers

From Michael Paquier
Subject Re: pgstat: allow a stats kind to use its own dedicated dsa/dshash
Date
Msg-id asNIbIJizyTVAtuO@paquier.xyz
Whole thread
In response to pgstat: allow a stats kind to use its own dedicated dsa/dshash  (Sami Imseih <samimseih@gmail.com>)
Responses Re: pgstat: allow a stats kind to use its own dedicated dsa/dshash
List pgsql-hackers
On Wed, Jul 15, 2026 at 12:16:26PM -0500, Sami Imseih wrote:
> Also, 2 new external APIs are introduced:
>     - pgstat_get_hash_for_kind(PgStat_Kind kind)
>     - pgstat_get_dsa_for_kind(PgStat_Kind kind)
> These allow the extension to retrieve the dshash and dsa pointers for
> both iterating through the entries and for setting the size limit on
> the dsa. Otherwise, the management of these separate structures is
> transparent to the extension and managed by the pgstat infrastructure.
>
> These APIs are necessary because we don't have higher-level abstractions
> in pgstats to do things like "iterate through this kind" or "set size
> limit for this stats kind"; such abstractions may be good to have to
> avoid using dshash_seq_* or dsa_set_size_limit directly, but I am not
> sure they are worth it at this point.
>
> Only variable-length stats can opt into own_hash. Fixed-length allocates their
> data into PgStat_ShmemControl.

Please note that this patch does not apply anymore.  Could you rebase,
please?
--
Michael

Attachment

pgsql-hackers by date:

Previous
From: Jakub Wartak
Date:
Subject: Re: doc: Document Linux cgroup memory limits
Next
From: solai v
Date:
Subject: Re: Preserve statistics targets with ALTER TABLE ALTER COLUMN TYPE