Re: index prefetching

From: Tomas Vondra <tomas(at)vondra(dot)me>
To: Peter Geoghegan <pg(at)bowt(dot)ie>, Rui Zhao <zhaorui126(at)gmail(dot)com>
Cc: Andres Freund <andres(at)anarazel(dot)de>, Alexandre Felipe <o(dot)alexandre(dot)felipe(at)gmail(dot)com>, Thomas Munro <thomas(dot)munro(at)gmail(dot)com>, Nazir Bilal Yavuz <byavuz81(at)gmail(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Melanie Plageman <melanieplageman(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Georgios <gkokolatos(at)protonmail(dot)com>, Konstantin Knizhnik <knizhnik(at)garret(dot)ru>, Dilip Kumar <dilipbalaut(at)gmail(dot)com>
Subject: Re: index prefetching
Date: 2026-12-03 18:43:56
Message-ID: 56bcad45-fe20-4116-838d-196662ac4e58@vondra.me
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

I've taken a quick look on the 0001 patch today. The patch is in a very
good shape, I like how the new API is shaped and how it's split between
the various heap/index layers.

Fow now I only have one minor question / comment about idx_tup_read.

The idx_tup_read used to mean "number of tuples returned by the scan of
the index", and AFAIK it used to be the number of TIDs returned by
amgettuple(). But now it counts the whole batch at once, no matter how
many of the TIDs end up being actually returned.

It's probably worse, because it also includes tuples from "prefetched"
batches (after 0007).

Maybe it's not wrong, but I'm not sure it's entirely desirable either.
It means that the counts will be inflated by an order of magnitude (or
more), relative to "old" values (e.g. for LIMIT 1 queries).

But I wonder how meaningful the value idx_tup_read is. I doubt it can be
used for the same analysis / monitoring as before. It's also harder
because the behavior will depend on which API the index uses. So there
will be a mix of indexes. That might be tricky to handle for various
monitoring tools.

regards

--
Tomas Vondra

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Masahiko Sawada 2026-12-03 18:44:27 Re: pg_dump writes a subscription's default slot name, which can't be restored
Previous Message Greg Burd 2026-12-03 17:56:05 Re: Let an ordering index scan hand its ORDER BY value to the target list