diff options
author | Andres Freund <andres@anarazel.de> | 2017-07-17 00:33:49 -0700 |
---|---|---|
committer | Andres Freund <andres@anarazel.de> | 2017-07-30 16:18:21 -0700 |
commit | cc9f08b6b813e30789100b6b34110d8be1090ba0 (patch) | |
tree | 77da9374d2bf7370eaef9eefe4595a32d3380b86 /src/backend/executor/nodeGatherMerge.c | |
parent | d47cfef7116fb36349949f5c757aa2112c249804 (diff) | |
download | postgresql-cc9f08b6b813e30789100b6b34110d8be1090ba0.tar.gz postgresql-cc9f08b6b813e30789100b6b34110d8be1090ba0.zip |
Move ExecProcNode from dispatch to function pointer based model.
This allows us to add stack-depth checks the first time an executor
node is called, and skip that overhead on following
calls. Additionally it yields a nice speedup.
While it'd probably have been a good idea to have that check all
along, it has become more important after the new expression
evaluation framework in b8d7f053c5c2bf2a7e - there's no stack depth
check in common paths anymore now. We previously relied on
ExecEvalExpr() being executed somewhere.
We should move towards that model for further routines, but as this is
required for v10, it seems better to only do the necessary (which
already is quite large).
Author: Andres Freund, Tom Lane
Reported-By: Julien Rouhaud
Discussion:
https://postgr.es/m/22833.1490390175@sss.pgh.pa.us
https://postgr.es/m/b0af9eaa-130c-60d0-9e4e-7a135b1e0c76@dalibo.com
Diffstat (limited to 'src/backend/executor/nodeGatherMerge.c')
-rw-r--r-- | src/backend/executor/nodeGatherMerge.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/backend/executor/nodeGatherMerge.c b/src/backend/executor/nodeGatherMerge.c index 0aff3798f75..9a81e225100 100644 --- a/src/backend/executor/nodeGatherMerge.c +++ b/src/backend/executor/nodeGatherMerge.c @@ -44,6 +44,7 @@ typedef struct GMReaderTupleBuffer */ #define MAX_TUPLE_STORE 10 +static TupleTableSlot *ExecGatherMerge(PlanState *pstate); static int32 heap_compare_slots(Datum a, Datum b, void *arg); static TupleTableSlot *gather_merge_getnext(GatherMergeState *gm_state); static HeapTuple gm_readnext_tuple(GatherMergeState *gm_state, int nreader, @@ -75,6 +76,7 @@ ExecInitGatherMerge(GatherMerge *node, EState *estate, int eflags) gm_state = makeNode(GatherMergeState); gm_state->ps.plan = (Plan *) node; gm_state->ps.state = estate; + gm_state->ps.ExecProcNode = ExecGatherMerge; /* * Miscellaneous initialization @@ -157,9 +159,10 @@ ExecInitGatherMerge(GatherMerge *node, EState *estate, int eflags) * the next qualifying tuple. * ---------------------------------------------------------------- */ -TupleTableSlot * -ExecGatherMerge(GatherMergeState *node) +static TupleTableSlot * +ExecGatherMerge(PlanState *pstate) { + GatherMergeState *node = castNode(GatherMergeState, pstate); TupleTableSlot *slot; ExprContext *econtext; int i; |