agora inbox for pgsql-hackers@postgresql.org  
help / color / mirror / Atom feed
From: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
To: Michael Paquier <michael@paquier.xyz>
Cc: Andres Freund <andres@anarazel.de>
Cc: pgsql-hackers@lists.postgresql.org, Sami Imseih <samimseih@gmail.com>
Subject: Re: Redesign per-backend statistics
Date: Tue, 22 Sep 2026 03:15:49 +0000
Message-ID: <arHy5b6v0s63faN4@bdtpg> (raw)
In-Reply-To: <arHI3tQDbpnd2El2@paquier.xyz>
References: <anCjoFkGah/uB7lw@bdtpg>
	<anU3OE2403PZdwJL@paquier.xyz>
	<anXQM2PoJ+6iYYT2@bdtpg>
	<anlVx_TD_Q8He5uf@paquier.xyz>
	<annj/ETYOFgbrGsn@bdtpg>
	<an3lxtz4TaYXXg/8@bdtpg>
	<arDZoI/5xHU2utRh@bdtpg>
	<fv5iqux4i5i6yveek2kz6v4rix3o7oyi2dlm7jkcarqb7pf4kk@fygc6ekt46ge>
	<arHI3tQDbpnd2El2@paquier.xyz>

Hi,

On Tue, Sep 22, 2026 at 09:16:30AM +0900, Michael Paquier wrote:
> On Mon, Sep 21, 2026 at 05:17:04AM -0400, Andres Freund wrote:
> > On 2026-09-21 07:15:44 +0000, Bertrand Drouvot wrote:
> >> +/* -------------------------------------------------------------------------
> >> + *
> >> + * pgstat_per_backend.c
> >> + *	  Generic infrastructure for per-backend statistics.
> >> + *
> >> + * This file manages the dedicated per-kind dshashes used for per-backend
> >> + * statistics, including entry creation, fetching, snapshots, transfer to
> >> + * global statistics, and removal.
> > 
> > It's not entirely obvious to me that a hash table is needed here. If I
> > understand correctly, this just going to be used for per-backend versions of
> > fixed stats.  Which means we could just as well allocate all the memory in
> > statically allocated shared memory at server start and have the per-backend
> > stats be accessible by nothing more than an array access?
> 
> Yeah.  Array access based on an procnum index is still feeling like
> the natural thing to do here (I think I've mentioned that upthread?).

Yeah you did mention it. I took your reply in [1] as agreeing with the concern
about reserving memory for mostly unused slots, though not necessarily with using
a dshash. Is your preference still for the array despite that memory cost?

[1]: https://postgr.es/m/anlVx_TD_Q8He5uf%40paquier.xyz

Regards,

-- 
Bertrand Drouvot
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com






view thread (11+ messages)

Message-ID: <arHy5b6v0s63faN4@bdtpg>
Permalink:  ../arHy5b6v0s63faN4@bdtpg/
Also on:    postgresql.org/message-id/arHy5b6v0s63faN4@bdtpg

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: bertranddrouvot.pg@gmail.com, michael@paquier.xyz, andres@anarazel.de, samimseih@gmail.com
  Subject: Re: Redesign per-backend statistics
  In-Reply-To: <arHy5b6v0s63faN4@bdtpg>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox