summaryrefslogtreecommitdiff
path: root/src/backend/executor/nodeLimit.c
diff options
context:
space:
mode:
authorAndres Freund <andres@anarazel.de>2017-07-17 00:33:49 -0700
committerAndres Freund <andres@anarazel.de>2017-07-30 16:18:21 -0700
commitcc9f08b6b813e30789100b6b34110d8be1090ba0 (patch)
tree77da9374d2bf7370eaef9eefe4595a32d3380b86 /src/backend/executor/nodeLimit.c
parentd47cfef7116fb36349949f5c757aa2112c249804 (diff)
downloadpostgresql-cc9f08b6b813e30789100b6b34110d8be1090ba0.tar.gz
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/nodeLimit.c')
-rw-r--r--src/backend/executor/nodeLimit.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/backend/executor/nodeLimit.c b/src/backend/executor/nodeLimit.c
index 2ed3523257..ac5a2ff0e6 100644
--- a/src/backend/executor/nodeLimit.c
+++ b/src/backend/executor/nodeLimit.c
@@ -37,9 +37,10 @@ static void pass_down_bound(LimitState *node, PlanState *child_node);
* filtering on the stream of tuples returned by a subplan.
* ----------------------------------------------------------------
*/
-TupleTableSlot * /* return: a tuple or NULL */
-ExecLimit(LimitState *node)
+static TupleTableSlot * /* return: a tuple or NULL */
+ExecLimit(PlanState *pstate)
{
+ LimitState *node = castNode(LimitState, pstate);
ScanDirection direction;
TupleTableSlot *slot;
PlanState *outerPlan;
@@ -378,6 +379,7 @@ ExecInitLimit(Limit *node, EState *estate, int eflags)
limitstate = makeNode(LimitState);
limitstate->ps.plan = (Plan *) node;
limitstate->ps.state = estate;
+ limitstate->ps.ExecProcNode = ExecLimit;
limitstate->lstate = LIMIT_INITIAL;