Re: Metadata and record block access stats for indexes

Mircea Cadariu <cadariu.mircea@gmail.com>

From: Mircea Cadariu <cadariu.mircea@gmail.com>
To: pgsql-hackers@postgresql.org
Date: 2025-07-04T16:00:02Z
Lists: pgsql-hackers

Attachments

Hi,

Just attaching v2 of the patch.  It’s a trimmed down version compared to 
what I started with.  For context, this is the original discussion on 
which this work is based on: 
https://www.postgresql.org/message-id/flat/CAH2-WzmdZqxCS1widYzjDAM%2BZ-Jz%3DejJoaWXDVw9Qy1UsK0tLA%40mail.gmail.com 


After applying the patch, you can run the following:

create table test (id bigint primary key);
insert into test select * from generate_series(1, 10_000);
select * from pg_statio_all_indexes where indexrelname = 'test_pkey';

The result will contain a new column: idx_metadata_blks.

Looking forward to your feedback.

Thanks,
Mircea