Hello,
I would like to get some feedback on that task.
> pg_statio_*_tables.idx_blks_hit are highly misleading in practice
> because they fail to take account of the difference between internal
> pages and leaf pages in B-Tree indexes.
I see it is still the case, so the issue is relevant, isn't it ?
> The main challenge would be
> passing information about what page we're dealing with (internal/leaf)
> to the place actually calling pgstat_count_buffer_(read|hit). That
> happens in ReadBufferExtended, which just has no idea what page it's
> dealing with. Not sure how to do that cleanly ...
I do not immediately see the way to pass the information in a
completely clean manner.
Either
(1) ReadBufferExtended needs to know the type of an index page (leaf/internal)
or
(2) caller of ReadBufferExtended that can check the page type needs to learn
if there was a hit and call pgstat_count_buffer_(read|hit) accordingly.
In either case necessary code changes seem quite invasive to me.
I have attached a code snippet to illustrate the second idea.
Regards,
Sergey