Re: Stats collector's idx_blks_hit value is highly misleading in practice - Mailing list pgsql-hackers

From Sergey Dudoladov
Subject Re: Stats collector's idx_blks_hit value is highly misleading in practice
Date
Msg-id CAA8Fd-rOJCR5-c8HqH758dcfDwXPiAUKSJa-N-Bujes9Hz5zuQ@mail.gmail.com
Whole thread Raw
In response to Re: Stats collector's idx_blks_hit value is highly misleading in practice  (John Naylor <john.naylor@enterprisedb.com>)
Responses Re: Stats collector's idx_blks_hit value is highly misleading in practice
List pgsql-hackers
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

Attachment

pgsql-hackers by date:

Previous
From: Daniel Gustafsson
Date:
Subject: Re: TAP output format in pg_regress
Next
From: David Rowley
Date:
Subject: Re: Can we do something to help stop users mistakenly using force_parallel_mode?