mirror of
https://github.com/postgres/postgres.git
synced 2025-09-09 13:09:39 +03:00
Make EXPLAIN ANALYZE report the numbers of rows rejected by filter steps.
This provides information about the numbers of tuples that were visited but not returned by table scans, as well as the numbers of join tuples that were considered and discarded within a join plan node. There is still some discussion going on about the best way to report counts for outer-join situations, but I think most of what's in the patch would not change if we revise that, so I'm going to go ahead and commit it as-is. Documentation changes to follow (they weren't in the submitted patch either). Marko Tiikkaja, reviewed by Marc Cousin, somewhat revised by Tom
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
|
||||
#include "access/genam.h"
|
||||
#include "access/heapam.h"
|
||||
#include "executor/instrument.h"
|
||||
#include "nodes/params.h"
|
||||
#include "nodes/plannodes.h"
|
||||
#include "utils/reltrigger.h"
|
||||
@@ -314,7 +315,7 @@ typedef struct ResultRelInfo
|
||||
TriggerDesc *ri_TrigDesc;
|
||||
FmgrInfo *ri_TrigFunctions;
|
||||
List **ri_TrigWhenExprs;
|
||||
struct Instrumentation *ri_TrigInstrument;
|
||||
Instrumentation *ri_TrigInstrument;
|
||||
List **ri_ConstraintExprs;
|
||||
JunkFilter *ri_junkFilter;
|
||||
ProjectionInfo *ri_projectReturning;
|
||||
@@ -967,8 +968,7 @@ typedef struct PlanState
|
||||
* nodes point to one EState for the whole
|
||||
* top-level plan */
|
||||
|
||||
struct Instrumentation *instrument; /* Optional runtime stats for this
|
||||
* plan node */
|
||||
Instrumentation *instrument; /* Optional runtime stats for this node */
|
||||
|
||||
/*
|
||||
* Common structural data for all Plan types. These links to subsidiary
|
||||
@@ -1008,6 +1008,18 @@ typedef struct PlanState
|
||||
#define innerPlanState(node) (((PlanState *)(node))->righttree)
|
||||
#define outerPlanState(node) (((PlanState *)(node))->lefttree)
|
||||
|
||||
/* Macros for inline access to certain instrumentation counters */
|
||||
#define InstrCountFiltered1(node, delta) \
|
||||
do { \
|
||||
if (((PlanState *)(node))->instrument) \
|
||||
((PlanState *)(node))->instrument->nfiltered1 += (delta); \
|
||||
} while(0)
|
||||
#define InstrCountFiltered2(node, delta) \
|
||||
do { \
|
||||
if (((PlanState *)(node))->instrument) \
|
||||
((PlanState *)(node))->instrument->nfiltered2 += (delta); \
|
||||
} while(0)
|
||||
|
||||
/*
|
||||
* EPQState is state for executing an EvalPlanQual recheck on a candidate
|
||||
* tuple in ModifyTable or LockRows. The estate and planstate fields are
|
||||
|
Reference in New Issue
Block a user