Thread
-
Re: Metadata and record block access stats for indexes
Mircea Cadariu <cadariu.mircea@gmail.com> — 2025-07-23T01:35:55Z
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