Re: Show WAL write and fsync stats in pg_stat_io

From: Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>
To: Nazir Bilal Yavuz <byavuz81(at)gmail(dot)com>
Cc: Michael Paquier <michael(at)paquier(dot)xyz>, 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-29 14:37:45
Message-ID: Z5o9OQ0nwWD9tKTR@ip-10-97-1-34.eu-west-3.compute.internal
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On Wed, Jan 29, 2025 at 01:49:20PM +0300, Nazir Bilal Yavuz wrote:
> Sorry for replying late.

No problem at all!

> It turns out that the difference is expected.
> It is because pg_stat_wal.wal_bytes tracks the total amount of WAL
> generated, while pg_stat_io tracks the I/Os that are written to disk.

Yeah, I do agree it's expected: Indeed pg_stat_wal.wal_bytes somehow "focus"
on the wal records size while the pg_stat_io's unit is the wal_block_size. That
makes sense and "only" affects the "bytes" (the remaining common fields looks
consistent across the 2 views).

> It is explicitly said that pg_stat_io tracks I/O operations and
> pg_stat_wal.wal_bytes tracks total amount of WAL generated in bytes. I
> think this is clear enough. Do you think we still need additional
> explanation?

I think that would not hurt to add a comment mentioning that the "bytes" are
expected to differ given the fact that the IO unit is the wal_block_size. But,
that said, I don't have a strong opinion on it, just a nice to have IMHO.

Regards,

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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Manika Singhal 2025-01-29 15:04:28 Re: EDB Installer initcluster script changes - review requested
Previous Message Alexander Pyhalov 2025-01-29 14:35:52 Re: SQLFunctionCache and generic plans