Attached patch teaches EXPLAIN ANALYZE to show "Table Block Fetches"
instead of "Heap Fetches" when reporting on an index-only scan node. I
believe that users will find this information more useful and
relevant: it describes the exact physical cost of *not* having the
relevant heap pages marked as all-visible in the visibility map,
without bringing tuples into it.

"Table Block Fetches" is exactly the number of times an index-only
scan had to switch to a new heap block. I'm not fussed about the name
we use for this, though I think that avoiding references to heap is
desirable. This information is table AM agnostic, at least in theory.

I lean towards not showing anything about IoS heap tuple fetches in
EXPLAIN ANALYZE, which is how it's done in this V1. But if there's a
consensus in favor of keeping it, I can easily produce a revision that
counts and reports on both things.

This approach became much easier following my recent commit ddce1da5,
which added a new slot-based table AM index scan interface. That
commit put the responsibility for maintaining the scan's "Heap
Fetches" counter into heapam. I suspect that the current approach
might be as much a consequence of how awkward it would have been to
teach nodeIndexonlyscan.c to do things this way as anything else.

-- 
Peter Geoghegan

Attachment: v1-0001-Show-block-not-tuple-fetches-in-EXPLAIN-ANALYZE.patch
Description: Binary data

Reply via email to