Re: per backend I/O statistics

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>
Cc: Nazir Bilal Yavuz <byavuz81(at)gmail(dot)com>, Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>, Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: per backend I/O statistics
Date: 2024-11-27 06:33:38
Message-ID: Z0a9QuH8HRLfT5kY@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Nov 25, 2024 at 03:47:59PM +0000, Bertrand Drouvot wrote:
> It also takes care of most of the comments that you have made in [1], meaning
> that it:
>
> - removes the backend type from PgStat_Backend and look for the backend type
> at "display" time.
> - creates PgStat_BackendPendingIO and PgStat_PendingIO now refers to it (I
> used PgStat_BackendPendingIO and not PgStat_BackendPending because this is what
> it is after all).
> - adds the missing comment related to the PID in the doc.
> - merges 0004 with 0001 (so that pg_stat_get_backend_io() is now part of 0001).
> - creates its own pgstat_backend.c file.

I have begun studying the patch, and I have one question.

+void
+pgstat_create_backend_stat(ProcNumber procnum)
[...]
+ /* Create the per-backend statistics entry */
+ if (pgstat_tracks_per_backend_bktype(MyBackendType))
+ pgstat_create_backend_stat(MyProcNumber);

Perhaps that's a very stupid question, but I was looking at this part
of the patch, and wondered why we don't use init_backend_cb? I
vaguely recalled that MyProcNumber and MyBackendType would be set
before we go through the pgstat initialization step. MyDatabaseId is
filled after the pgstat initialization, but we don't care about this
information for such backend stats.
--
Michael

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Kirill Reshke 2024-11-27 06:38:20 Re: CREATE SCHEMA ... CREATE DOMAIN support
Previous Message Michael Paquier 2024-11-27 06:20:19 Re: Large expressions in indexes can't be stored (non-TOASTable)