Evaluate arguments of correlated SubPlans in the referencing ExprState
Andres Freund <andres@anarazel.de>
Evaluate arguments of correlated SubPlans in the referencing ExprState Until now we generated an ExprState for each parameter to a SubPlan and evaluated them one-by-one ExecScanSubPlan. That's sub-optimal as creating lots of small ExprStates a) makes JIT compilation more expensive b) wastes memory c) is a bit slower to execute This commit arranges to evaluate parameters to a SubPlan as part of the ExprState referencing a SubPlan, using the new EEOP_PARAM_SET expression step. We emit one EEOP_PARAM_SET for each argument to a subplan, just before the EEOP_SUBPLAN step. It likely is worth using EEOP_PARAM_SET in other places as well, e.g. for SubPlan outputs, nestloop parameters and - more ambitiously - to get rid of ExprContext->domainValue/caseValue/ecxt_agg*. But that's for later. Author: Andres Freund <andres@anarazel.de> Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> Reviewed-by: Alena Rybakina <lena.ribackina@yandex.ru> Discussion: https://postgr.es/m/20230225214401.346ancgjqc3zmvek@awork3.anarazel.de
Files
| Path | Change | +/− |
|---|---|---|
| src/backend/executor/execExpr.c | modified | +70 −33 |
| src/backend/executor/execExprInterp.c | modified | +26 −0 |
| src/backend/executor/execProcnode.c | modified | +5 −0 |
| src/backend/executor/nodeSubplan.c | modified | +12 −17 |
| src/backend/jit/llvm/llvmjit_expr.c | modified | +6 −0 |
| src/backend/jit/llvm/llvmjit_types.c | modified | +1 −0 |
| src/include/executor/execExpr.h | modified | +5 −1 |
| src/include/nodes/execnodes.h | modified | +0 −1 |
Discussion
- Evaluate arguments of correlated SubPlans in the referencing ExprState 23 messages · 2023-02-25 → 2024-08-01