Re: Add shared buffer hits to pg_stat_io

Bertrand Drouvot <bertranddrouvot.pg@gmail.com>

From: "Drouvot, Bertrand" <bertranddrouvot.pg@gmail.com>
To: Melanie Plageman <melanieplageman@gmail.com>, Andres Freund <andres@anarazel.de>
Cc: Pg Hackers <pgsql-hackers@postgresql.org>, Maciek Sakrejda <m.sakrejda@gmail.com>, Justin Pryzby <pryzby@telsasoft.com>, smilingsamay@gmail.com, Kyotaro Horiguchi <horikyota.ntt@gmail.com>, Lukas Fittl <lukas@fittl.com>, Magnus Hagander <magnus@hagander.net>, Alvaro Herrera <alvherre@alvh.no-ip.org>
Date: 2023-03-09T16:03:13Z
Lists: pgsql-hackers
Hi,

On 3/9/23 2:23 PM, Melanie Plageman wrote:
> On Wed, Mar 8, 2023 at 2:23 PM Andres Freund <andres@anarazel.de> wrote:
>>
>> On 2023-03-08 13:44:32 -0500, Melanie Plageman wrote:
>>> However, I am concerned that, while unlikely, this could be flakey.
>>> Something could happen to force all of those blocks out of shared
>>> buffers (even though they were just read in) before we hit them.
>>
>> You could make the test query a simple nested loop self-join, that'll prevent
>> the page being evicted, because it'll still be pinned on the outer side, while
>> generating hits on the inner side.
> 
> Good idea. v3 attached.

Thanks! The added test looks good to me.

Regards,

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



Commits

  1. Track shared buffer hits in pg_stat_io