Add callback in pgstats for backend initialization

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Add callback in pgstats for backend initialization
Date: 2024-09-03 01:52:20
Message-ID: ZtZr1K4PLdeWclXY@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi all,

Currently, the backend-level initialization of pgstats happens in
pgstat_initialize(), where we are using a shortcut for the WAL stats,
with pgstat_init_wal().

I'd like to propose to add a callback for that, so as in-core or
custom pgstats kinds can assign custom actions when initializing a
backend. The use-case I had for this one are pretty close to what we
do for WAL, where we would rely on a difference of state depending on
what may have existed before reaching the initialization path. So
this can offer more precision. Another case, perhaps less
interesting, is to be able to initialize some static backend state.

I wanted to get that sent for the current commit fest, but did not get
back in time to it. Anyway, here it is. This gives the simple patch
attached.

Thanks,
--
Michael

Attachment Content-Type Size
0001-Add-callback-for-backend-initialization-in-pgstats.patch text/x-diff 2.9 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Smith 2024-09-03 02:00:19 Re: GUC names in messages
Previous Message Thomas Munro 2024-09-03 01:47:34 Re: macOS prefetching support