11diff --git a/src/backend/commands/explain.c b/src/backend/commands/explain.c
2- index11047f7..3f5c638 100644
2+ index82ba58e..bf7dfa6 100644
33--- a/src/backend/commands/explain.c
44+++ b/src/backend/commands/explain.c
5- @@ -653 ,15 +653 ,35 @@ report_triggers(ResultRelInfo *rInfo, bool show_relname, ExplainState *es)
5+ @@ -667 ,15 +667 ,35 @@ report_triggers(ResultRelInfo *rInfo, bool show_relname, ExplainState *es)
66 Instrumentation *instr = rInfo->ri_TrigInstrument + nt;
77 char *relname;
88 char *conname = NULL;
@@ -41,7 +41,7 @@ index 11047f7..3f5c638 100644
4141 continue;
4242
4343 ExplainOpenGroup("Trigger", NULL, true, es);
44- @@ -687 ,9 +707 ,9 @@ report_triggers(ResultRelInfo *rInfo, bool show_relname, ExplainState *es)
44+ @@ -701 ,9 +721 ,9 @@ report_triggers(ResultRelInfo *rInfo, bool show_relname, ExplainState *es)
4545 appendStringInfo(es->str, " on %s", relname);
4646 if (es->timing)
4747 appendStringInfo(es->str, ": time=%.3f calls=%.0f\n",
@@ -53,7 +53,7 @@ index 11047f7..3f5c638 100644
5353 }
5454 else
5555 {
56- @@ -698 ,8 +718 ,8 @@ report_triggers(ResultRelInfo *rInfo, bool show_relname, ExplainState *es)
56+ @@ -712 ,8 +732 ,8 @@ report_triggers(ResultRelInfo *rInfo, bool show_relname, ExplainState *es)
5757 ExplainPropertyText("Constraint Name", conname, es);
5858 ExplainPropertyText("Relation", relname, es);
5959 if (es->timing)
@@ -64,7 +64,7 @@ index 11047f7..3f5c638 100644
6464 }
6565
6666 if (conname)
67- @@ -1247 ,8 +1267 ,11 @@ ExplainNode(PlanState *planstate, List *ancestors,
67+ @@ -1225 ,8 +1245 ,11 @@ ExplainNode(PlanState *planstate, List *ancestors,
6868 * instrumentation results the user didn't ask for. But we do the
6969 * InstrEndLoop call anyway, if possible, to reduce the number of cases
7070 * auto_explain has to contend with.
@@ -77,7 +77,7 @@ index 11047f7..3f5c638 100644
7777 InstrEndLoop(planstate->instrument);
7878
7979 if (es->analyze &&
80- @@ -1281 ,7 +1304 ,7 @@ ExplainNode(PlanState *planstate, List *ancestors,
80+ @@ -1259 ,7 +1282 ,7 @@ ExplainNode(PlanState *planstate, List *ancestors,
8181 ExplainPropertyFloat("Actual Loops", nloops, 0, es);
8282 }
8383 }
@@ -86,7 +86,7 @@ index 11047f7..3f5c638 100644
8686 {
8787 if (es->format == EXPLAIN_FORMAT_TEXT)
8888 appendStringInfoString(es->str, " (never executed)");
89- @@ -1297 ,6 +1320 ,75 @@ ExplainNode(PlanState *planstate, List *ancestors,
89+ @@ -1275 ,6 +1298 ,75 @@ ExplainNode(PlanState *planstate, List *ancestors,
9090 }
9191 }
9292
@@ -162,7 +162,7 @@ index 11047f7..3f5c638 100644
162162 /* in text format, first line ends here */
163163 if (es->format == EXPLAIN_FORMAT_TEXT)
164164 appendStringInfoChar(es->str, '\n');
165- @@ -2293 ,20 +2385 ,17 @@ show_instrumentation_count(const char *qlabel, int which,
165+ @@ -2269 ,20 +2361 ,17 @@ show_instrumentation_count(const char *qlabel, int which,
166166 if (!es->analyze || !planstate->instrument)
167167 return;
168168
@@ -189,7 +189,7 @@ index 11047f7..3f5c638 100644
189189 }
190190
191191 /*
192- @@ -2658 ,14 +2747 ,28 @@ show_modifytable_info(ModifyTableState *mtstate, List *ancestors,
192+ @@ -2754 ,14 +2843 ,28 @@ show_modifytable_info(ModifyTableState *mtstate, List *ancestors,
193193 doubleinsert_path;
194194 doubleother_path;
195195
@@ -224,10 +224,10 @@ index 11047f7..3f5c638 100644
224224 }
225225 }
226226diff --git a/src/backend/executor/instrument.c b/src/backend/executor/instrument.c
227- indexf5351eb..591ea0f 100644
227+ index2614bf4..56d8a49 100644
228228--- a/src/backend/executor/instrument.c
229229+++ b/src/backend/executor/instrument.c
230- @@ -118 ,6 +118 ,8 @@ InstrEndLoop(Instrumentation *instr)
230+ @@ -129 ,6 +129 ,8 @@ InstrEndLoop(Instrumentation *instr)
231231 instr->total += totaltime;
232232 instr->ntuples += instr->tuplecount;
233233 instr->nloops += 1;
@@ -236,17 +236,17 @@ index f5351eb..591ea0f 100644
236236
237237 /* Reset for next cycle (if any) */
238238 instr->running = false;
239- @@ -125 ,6 +127 ,8 @@ InstrEndLoop(Instrumentation *instr)
239+ @@ -136 ,6 +138 ,8 @@ InstrEndLoop(Instrumentation *instr)
240240 INSTR_TIME_SET_ZERO(instr->counter);
241241 instr->firsttuple = 0;
242242 instr->tuplecount = 0;
243243+ instr->nfiltered1 = 0;
244244+ instr->nfiltered2 = 0;
245245 }
246246
247- /*dst += add - sub */
247+ /*aggregate instrumentation information */
248248diff --git a/src/include/commands/explain.h b/src/include/commands/explain.h
249- index26fcc5b..2ad3fb8 100644
249+ index3d0a5ab..1f0bde7 100644
250250--- a/src/include/commands/explain.h
251251+++ b/src/include/commands/explain.h
252252@@ -35,6 +35,8 @@ typedef struct ExplainState
@@ -255,11 +255,11 @@ index 26fcc5b..2ad3fb8 100644
255255 ExplainFormat format;/* output format */
256256+ boolruntime;/* print intermediate state of query execution,
257257+ not after completion */
258- /*other states */
259- PlannedStmt *pstmt ;/*top of plan */
260- List *rtable; /*range table */
258+ /*state for output formatting --- not reset for each new plan tree */
259+ intindent ;/*current indentation level */
260+ List *grouping_stack; /*format-specific grouping state */
261261diff --git a/src/include/executor/instrument.h b/src/include/executor/instrument.h
262- indexc9a2129..c53517f 100644
262+ index8e5f0ec..2a1b512 100644
263263--- a/src/include/executor/instrument.h
264264+++ b/src/include/executor/instrument.h
265265@@ -52,14 +52,16 @@ typedef struct Instrumentation