Re: Make pg_stat_io view count IOs as bytes instead of blocks

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Nazir Bilal Yavuz <byavuz81(at)gmail(dot)com>
Cc: Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>, Melanie Plageman <melanieplageman(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Make pg_stat_io view count IOs as bytes instead of blocks
Date: 2024-12-24 06:12:48
Message-ID: Z2pQ4Jo4Ujq4b4oA@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Dec 06, 2024 at 12:41:55PM +0300, Nazir Bilal Yavuz wrote:
> Thanks! I think 'track' is a better word in this context. I used
> 'tracked in ...', as it sounded more correct to me (I hope it is).

Splitting op_bytes into three fields sounds like a good idea. Count
me in regarding the concept to depend less on BLCKSZ.

typedef enum IOOp
{
+ /* IOs not tracked in bytes */
IOOP_EVICT,
- IOOP_EXTEND,
IOOP_FSYNC,
IOOP_HIT,
- IOOP_READ,
IOOP_REUSE,
- IOOP_WRITE,
IOOP_WRITEBACK,
+
+ /* IOs tracked in bytes */
+ IOOP_EXTEND,
+ IOOP_READ,
+ IOOP_WRITE,
} IOOp;

pg_stat_io_build_tuples() is now the code path taken when building the
tuples returned by pg_stat_io, meaning that the new function called
pg_stat_get_backend_io() is also going to need an update in its list
of output parameters to accomodate with what you are changing here.
Calling your new pgstat_get_io_byte_index() in the new refactored
routine is also necessary. Sorry about that.

Could you send a rebase, please? I can promise to review this
thread's new patch, as that will also move the needle regarding your
work with pg_stat_io to track WAL activity.
--
Michael

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message wenhui qiu 2024-12-24 06:20:15 adjust_limit_rows_costs algorithm
Previous Message Michael Paquier 2024-12-24 05:35:16 Re: per backend I/O statistics