Re: Use instr_time for pg_stat_database block read/write time counters - Mailing list pgsql-hackers

From Michael Paquier
Subject Re: Use instr_time for pg_stat_database block read/write time counters
Date
Msg-id ar7lYmpCrQGAHsCm@paquier.xyz
Whole thread
In response to Use instr_time for pg_stat_database block read/write time counters  (Bernd Reiß <bd_reiss@gmx.at>)
Responses Re: Use instr_time for pg_stat_database block read/write time counters
List pgsql-hackers
On Mon, Sep 28, 2026 at 02:24:52PM +0200, Bernd Reiß wrote:
> @@ -125,7 +125,7 @@ pgstat_count_io_op_time(IOObject io_object, IOContext io_context, IOOp io_op,
>          {
>              if (io_op == IOOP_WRITE || io_op == IOOP_EXTEND)
>              {
> -                pgstat_count_buffer_write_time(INSTR_TIME_GET_MICROSEC(io_time));
> +                INSTR_TIME_ADD(pgStatBlockWriteTime, io_time);
>                  if (io_object == IOOBJECT_RELATION)
>                      INSTR_TIME_ADD(pgBufferUsage.shared_blk_write_time, io_time);
>                  else if (io_object == IOOBJECT_TEMP_RELATION)
> @@ -133,7 +133,7 @@ pgstat_count_io_op_time(IOObject io_object, IOContext io_context, IOOp io_op,
>              }
>              else if (io_op == IOOP_READ)
>              {
> -                pgstat_count_buffer_read_time(INSTR_TIME_GET_MICROSEC(io_time));
> +                INSTR_TIME_ADD(pgStatBlockReadTime, io_time);
>                  if (io_object == IOOBJECT_RELATION)
>                      INSTR_TIME_ADD(pgBufferUsage.shared_blk_read_time, io_time);
>                  else if (io_object == IOOBJECT_TEMP_RELATION)

Hmm.  This part of the patch touches a performance-sensitive area.
This is exchanging one addition for another, which I doubt really
matters, but who knows..  Andres, any thoughts perhaps?
--
Michael

Attachment

pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: Report index currently being vacuumed in pg_stat_progress_vacuum
Next
From: Tom Lane
Date:
Subject: Re: Partial indexes on system catalogs