Re: Metadata and record block access stats for indexes - Mailing list pgsql-hackers

From Mircea Cadariu
Subject Re: Metadata and record block access stats for indexes
Date
Msg-id 5d5dd2de-76ef-48d8-a794-811b89697fb2@gmail.com
Whole thread Raw
In response to Re: Metadata and record block access stats for indexes  (Frédéric Yhuel <frederic.yhuel@dalibo.com>)
List pgsql-hackers
Hi Frédéric,

Thanks a lot for trying out my (first) patch! Much appreciated.


On 20/07/2025 21:54, Frédéric Yhuel wrote:
> Your patch applies cleanly and seems to work well.

Cool!


> because most of the index non-leaf pages should be in the cache. Right?

Yes indeed, it's an assumption in the implementation, that the non-leaf 
pages will roughly always be in the cache.


> This should probably be documented somewhere?

I'm still familiarising myself about what to document where, whether 
things should be in the official docs or separate blog posts. In the 
patch I only documented the new column next to the existing ones for now.


> --> 3 pages: the root of the tree, one internal page and one leaf

Yes, this is correct.


> primary sleaf bench [42323] # select idx_blks_read, idx_blks_hit, 
> idx_metadata_blks from pg_statio_all_indexes where indexrelname = 
> 'pgbench_accounts_pkey';
>  idx_blks_read | idx_blks_hit | idx_metadata_blks
> ---------------+--------------+-------------------
>              4 |            3 |                 5
>
> --> 4 more pages: same as before, already in cache, plus the index 
> meta page, read outside shared buffers because we started a new session?

Yes, that's my understanding too.


Thanks!


Kind regards,

Mircea Cadariu





pgsql-hackers by date:

Previous
From: Peter Geoghegan
Date:
Subject: Re: index prefetching
Next
From: "Joel Jacobson"
Date:
Subject: Re: Optimize LISTEN/NOTIFY