From acaf8e8af643f05605eab21ad3e5a04a8714f06a Mon Sep 17 00:00:00 2001 From: Alvaro Herrera Date: Mon, 9 Apr 2018 18:41:20 -0300 Subject: [PATCH 2/2] use nfiltered3 instead of ad-hoc counter --- src/backend/commands/explain.c | 8 ++------ src/backend/executor/nodeIndexonlyscan.c | 3 +-- src/include/nodes/execnodes.h | 1 - 3 files changed, 3 insertions(+), 9 deletions(-) diff --git a/src/backend/commands/explain.c b/src/backend/commands/explain.c index 347fbbe1cf..434051e7df 100644 --- a/src/backend/commands/explain.c +++ b/src/backend/commands/explain.c @@ -1459,12 +1459,8 @@ ExplainNode(PlanState *planstate, List *ancestors, show_instrumentation_count("Rows Removed by Filter", 1, planstate, es); if (es->analyze) - { - long heapFetches = - ((IndexOnlyScanState *) planstate)->ioss_HeapFetches; - - ExplainPropertyInteger("Heap Fetches", NULL, heapFetches, es); - } + ExplainPropertyInteger("Heap Fetches", NULL, + planstate->instrument->nfiltered3, es); break; case T_BitmapIndexScan: show_scan_qual(((BitmapIndexScan *) plan)->indexqualorig, diff --git a/src/backend/executor/nodeIndexonlyscan.c b/src/backend/executor/nodeIndexonlyscan.c index ddc0ae9061..ef835f13c2 100644 --- a/src/backend/executor/nodeIndexonlyscan.c +++ b/src/backend/executor/nodeIndexonlyscan.c @@ -162,7 +162,7 @@ IndexOnlyNext(IndexOnlyScanState *node) /* * Rats, we have to visit the heap to check visibility. */ - node->ioss_HeapFetches++; + InstrCountFiltered3(node, 1); tuple = index_fetch_heap(scandesc); if (tuple == NULL) continue; /* no visible tuple, try next index entry */ @@ -509,7 +509,6 @@ ExecInitIndexOnlyScan(IndexOnlyScan *node, EState *estate, int eflags) indexstate->ss.ps.plan = (Plan *) node; indexstate->ss.ps.state = estate; indexstate->ss.ps.ExecProcNode = ExecIndexOnlyScan; - indexstate->ioss_HeapFetches = 0; /* * Miscellaneous initialization diff --git a/src/include/nodes/execnodes.h b/src/include/nodes/execnodes.h index 06456f07cc..d00839c161 100644 --- a/src/include/nodes/execnodes.h +++ b/src/include/nodes/execnodes.h @@ -1387,7 +1387,6 @@ typedef struct IndexOnlyScanState Relation ioss_RelationDesc; IndexScanDesc ioss_ScanDesc; Buffer ioss_VMBuffer; - long ioss_HeapFetches; Size ioss_PscanLen; } IndexOnlyScanState; -- 2.11.0