Re: pgstat: allow a stats kind to use its own dedicated dsa/dshash

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Sami Imseih <samimseih(at)gmail(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pgstat: allow a stats kind to use its own dedicated dsa/dshash
Date: 2026-10-05 06:49:16
Message-ID: asNIbIJizyTVAtuO@paquier.xyz
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message solai v 2026-10-05 06:57:40 Re: Preserve statistics targets with ALTER TABLE ALTER COLUMN TYPE
Previous Message Jakub Wartak 2026-10-05 06:37:28 Re: doc: Document Linux cgroup memory limits