Re: Add shared buffer hits to pg_stat_io

Andres Freund <andres@anarazel.de>

From: Andres Freund <andres@anarazel.de>
To: Melanie Plageman <melanieplageman@gmail.com>
Cc: "Drouvot, Bertrand" <bertranddrouvot.pg@gmail.com>, 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-31T02:39:50Z
Lists: pgsql-hackers
Hi,

On 2023-03-09 08:23:46 -0500, Melanie Plageman wrote:
> Good idea. v3 attached.

I committed this, after some small regression test changes. I was worried that
the query for testing buffer hits might silently change in the future, so I
added an EXPLAIN for the query. Also removed the need for the explicit RESETs
by using BEGIN; SET LOCAL ...; query; COMMIT;.

Thanks for the patch Melanie and the review Bertrand. I'm excited about
finally being able to compute meaningful cache hit ratios :)

Regards,

Andres



Commits

  1. Track shared buffer hits in pg_stat_io