Patch by me; review by Tom Lane, Jeff Davis, and Peter Geoghegan.
if (plan->qual)
show_instrumentation_count("Rows Removed by Filter", 1,
planstate, es);
+ if (es->analyze)
+ ExplainPropertyLong("Heap Fetches",
+ ((IndexOnlyScanState *) planstate)->ioss_HeapFetches, es);
break;
case T_BitmapIndexScan:
show_scan_qual(((BitmapIndexScan *) plan)->indexqualorig,
/*
* Rats, we have to visit the heap to check visibility.
*/
+ node->ioss_HeapFetches++;
tuple = index_fetch_heap(scandesc);
if (tuple == NULL)
continue; /* no visible tuple, try next index entry */
indexstate = makeNode(IndexOnlyScanState);
indexstate->ss.ps.plan = (Plan *) node;
indexstate->ss.ps.state = estate;
+ indexstate->ioss_HeapFetches = 0;
/*
* Miscellaneous initialization
* RelationDesc index relation descriptor
* ScanDesc index scan descriptor
* VMBuffer buffer in use for visibility map testing, if any
+ * HeapFetches number of tuples we were forced to fetch from heap
* ----------------
*/
typedef struct IndexOnlyScanState
Relation ioss_RelationDesc;
IndexScanDesc ioss_ScanDesc;
Buffer ioss_VMBuffer;
+ long ioss_HeapFetches;
} IndexOnlyScanState;
/* ----------------