Re: [Patch] New pg_stat_tablespace view - Mailing list pgsql-hackers

From Bernd Reiß
Subject Re: [Patch] New pg_stat_tablespace view
Date
Msg-id fbf06ac2-15ce-412a-92de-f533d2f9774d@gmx.at
Whole thread
In response to Re: [Patch] New pg_stat_tablespace view  (shihao zhong <zhong950419@gmail.com>)
List pgsql-hackers
Hi Shihao,

On 19/09/2026 05:07, shihao zhong wrote:
> Hi Bernd,
>
> Thanks for testing.
>
>  > blks_read differs exactly by 3 and blks_hit by 7
>
> I can reproduce this, and it does not need a restart. pg_stat_reset()
> clears the database entry and pg_stat_reset_shared() clears the tablespace
> entry. If more than a second passes between them, the backend flushes its
> pending counts in the gap, and the entry that was reset first keeps them.
> Swapping the two resets flips the sign. With both resets in one statement
> the numbers always match.
>

Yes, this explains it.

>  > there is some skew in blk_read_time and blk_write_time
>
> Part of it was the second clock read. v7 reuses the time that
> pgstat_count_io_op_time() already computed.
>
>
>  > one test still checks for >= 0
>
> Fixed.
>

I like this: Having the test being strictly bigger and comparing to
beforehand values makes much sense to me.


> v7 attached.
>
> Thanks,
> Shihao
>
>
>

Best
Bernd



pgsql-hackers by date:

Previous
From: Jacob Champion
Date:
Subject: Re: [PATCH] Add a check_hook for output_plugin_libraries
Next
From: Zsolt Parragi
Date:
Subject: Re: Unlogged materialized views