Re: Use pgstat_kind_infos to read fixed shared stats structs

From: Andres Freund <andres(at)anarazel(dot)de>
To: Tristan Partin <tristan(at)neon(dot)tech>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Use pgstat_kind_infos to read fixed shared stats structs
Date: 2024-05-07 18:29:05
Message-ID: 20240507182905.xfzlajkhvpi7frab@awork3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On 2024-05-06 14:07:53 -0500, Tristan Partin wrote:
> Instead of needing to be explicit, we can just iterate the
> pgstat_kind_infos array to find the memory locations to read into.

> This was originally thought of by Andres in
> 5891c7a8ed8f2d3d577e7eea34dacff12d7b6bbd.
>
> Not a fix, per se, but it does remove a comment. Perhaps the discussion will
> just lead to someone deleting the comment, and keeping the code as is.
> Either way, a win :).

I think it's a good idea. I'd really like to allow extensions to register new
types of stats eventually. Stuff like pg_stat_statements having its own,
fairly ... mediocre, stats storage shouldn't be necessary.

Do we need to increase the stats version, I didn't check if the order we
currently store things in and the numerical order of the stats IDs are the
same.

Greetings,

Andres Freund

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Nathan Bossart 2024-05-07 18:40:51 Re: pg_sequence_last_value() for unlogged sequences on standbys
Previous Message Tom Lane 2024-05-07 18:20:55 Re: Revert: Remove useless self-joins *and* -DREALLOCATE_BITMAPSETS make server crash, regress test fail.