Re: Show WAL write and fsync stats in pg_stat_io - Mailing list pgsql-hackers

From Bertrand Drouvot
Subject Re: Show WAL write and fsync stats in pg_stat_io
Date
Msg-id Z5o9OQ0nwWD9tKTR@ip-10-97-1-34.eu-west-3.compute.internal
Whole thread Raw
In response to Re: Show WAL write and fsync stats in pg_stat_io  (Nazir Bilal Yavuz <byavuz81@gmail.com>)
List 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



pgsql-hackers by date:

Previous
From: Melanie Plageman
Date:
Subject: Re: Eagerly scan all-visible pages to amortize aggressive vacuum
Next
From: Manika Singhal
Date:
Subject: Re: EDB Installer initcluster script changes - review requested