Re: Show WAL write and fsync stats in pg_stat_io

From: Nazir Bilal Yavuz <byavuz81(at)gmail(dot)com>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>, Melanie Plageman <melanieplageman(at)gmail(dot)com>, Andres Freund <andres(at)anarazel(dot)de>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, "bharath(dot)rupireddyforpostgres(at)gmail(dot)com" <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>, Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
Subject: Re: Show WAL write and fsync stats in pg_stat_io
Date: 2025-01-27 13:59:34
Message-ID: CAN55FZ0fO3hKexD33Xriwo2QKi7MLyKxQEOh9x=HfK+ZsV2U9w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On Mon, 27 Jan 2025 at 03:52, Michael Paquier <michael(at)paquier(dot)xyz> wrote:
>
> On Fri, Jan 24, 2025 at 06:29:46PM +0300, Nazir Bilal Yavuz wrote:
> > By saying that, this does not solve the problem; there is still a
> > difference although you omit WAL initialization stats from the
> > pg_stat_io.
>
> Reattaching the remaining patches to make the cfbot happy, as 0001 has
> been applied as 87a6690cc695.

Thanks!

>
> - if (track_wal_io_timing)
> - {
> - instr_time end;
> -
> - INSTR_TIME_SET_CURRENT(end);
> - INSTR_TIME_ACCUM_DIFF(PendingWalStats.wal_write_time, end, start);
> - }
>
> In 0002, you are removing PendingWalStats.wal_write_time, which does
> not seem OK to me because we should still aggregate this data for
> track_wal_io_timing, no?

We use PendingWalStats.wal_[ write | sync ]_time only to show timings
on the pg_stat_wal view, right? And now these pg_stat_wal.wal_[ write
| sync ]_time datas are fetched from the pg_stat_io view when the
track_wal_io_timing is on. So, I think it is correct to remove these.

I made a mistake while splitting the patches. The places where
'PendingWalStats.wal_[ write | sync ]_time are incremented (the code
piece you shared)' are removed in 0002 (0001 now), but they should be
removed in 0003 (0002 now) instead. This is corrected in v11.

--
Regards,
Nazir Bilal Yavuz
Microsoft

Attachment Content-Type Size
v11-0001-Add-WAL-I-O-stats-to-both-pg_stat_io-view-and-pe.patch text/x-patch 22.9 KB
v11-0002-Fetch-timing-columns-from-pg_stat_io-in-the-pg_s.patch text/x-patch 9.7 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Umar Hayat 2025-01-27 14:00:24 Re: Add XMLNamespaces to XMLElement
Previous Message Maxim Orlov 2025-01-27 13:58:05 Re: Casts from jsonb to other types should cope with json null