Re: Metadata and record block access stats for indexes

From: Mircea Cadariu <cadariu(dot)mircea(at)gmail(dot)com>
To: Frédéric Yhuel <frederic(dot)yhuel(at)dalibo(dot)com>, pgsql-hackers(at)postgresql(dot)org
Cc: Peter Geoghegan <pg(at)bowt(dot)ie>, tomas(at)vondra(dot)me
Subject: Re: Metadata and record block access stats for indexes
Date: 2025-07-23 01:35:55
Message-ID: 5d5dd2de-76ef-48d8-a794-811b89697fb2@gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Joel Jacobson 2025-07-23 01:39:30 Re: Optimize LISTEN/NOTIFY
Previous Message Peter Geoghegan 2025-07-23 01:31:47 Re: index prefetching