From 15a8f8caad14c1f85b23d97842d0c27b106cc10e Mon Sep 17 00:00:00 2001 From: Alvaro Herrera Date: Tue, 10 Apr 2018 15:56:15 -0300 Subject: Fix IndexOnlyScan counter for heap fetches in parallel mode The HeapFetches counter was using a simple value in IndexOnlyScanState, which fails to propagate values from parallel workers; so the counts are wrong when IndexOnlyScan runs in parallel. Move it to Instrumentation, like all the other counters. While at it, change INSERT ON CONFLICT conflicting tuple counter to use the new ntuples2 instead of nfiltered2, which is a blatant misuse. Discussion: https://postgr.es/m/20180409215851.idwc75ct2bzi6tea@alvherre.pgsql --- src/backend/commands/explain.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'src/backend/commands/explain.c') diff --git a/src/backend/commands/explain.c b/src/backend/commands/explain.c index 989b6aad67b..306e6444669 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); - } + ExplainPropertyFloat("Heap Fetches", NULL, + planstate->instrument->ntuples2, 0, es); break; case T_BitmapIndexScan: show_scan_qual(((BitmapIndexScan *) plan)->indexqualorig, @@ -3132,7 +3128,7 @@ show_modifytable_info(ModifyTableState *mtstate, List *ancestors, /* count the number of source rows */ total = mtstate->mt_plans[0]->instrument->ntuples; - other_path = mtstate->ps.instrument->nfiltered2; + other_path = mtstate->ps.instrument->ntuples2; insert_path = total - other_path; ExplainPropertyFloat("Tuples Inserted", NULL, -- cgit v1.2.3