From d35d32d7112bc632c6a305e9dffdec0082bbdf00 Mon Sep 17 00:00:00 2001 From: Daniel Gustafsson Date: Tue, 11 Mar 2025 12:02:42 +0100 Subject: Add special case fast-paths for strict functions Many STRICT function calls will have one or two arguments, in which case we can speed up checking for NULL input by avoiding setting up a loop over the arguments. This adds EEOP_FUNCEXPR_STRICT_1 and the corresponding EEOP_FUNCEXPR_STRICT_2 for functions with one and two arguments respectively. Author: Andres Freund Co-authored-by: Daniel Gustafsson Reviewed-by: Andreas Karlsson Discussion: https://postgr.es/m/415721CE-7D2E-4B74-B5D9-1950083BA03E@yesql.se Discussion: https://postgr.es/m/20191023163849.sosqbfs5yenocez3@alap3.anarazel.de --- src/include/executor/execExpr.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/include/executor') diff --git a/src/include/executor/execExpr.h b/src/include/executor/execExpr.h index fabdf145a8e..75366203706 100644 --- a/src/include/executor/execExpr.h +++ b/src/include/executor/execExpr.h @@ -116,11 +116,13 @@ typedef enum ExprEvalOp /* * Evaluate function call (including OpExprs etc). For speed, we - * distinguish in the opcode whether the function is strict and/or - * requires usage stats tracking. + * distinguish in the opcode whether the function is strict with 1, 2, or + * more arguments and/or requires usage stats tracking. */ EEOP_FUNCEXPR, EEOP_FUNCEXPR_STRICT, + EEOP_FUNCEXPR_STRICT_1, + EEOP_FUNCEXPR_STRICT_2, EEOP_FUNCEXPR_FUSAGE, EEOP_FUNCEXPR_STRICT_FUSAGE, @@ -276,6 +278,7 @@ typedef enum ExprEvalOp EEOP_AGG_STRICT_DESERIALIZE, EEOP_AGG_DESERIALIZE, EEOP_AGG_STRICT_INPUT_CHECK_ARGS, + EEOP_AGG_STRICT_INPUT_CHECK_ARGS_1, EEOP_AGG_STRICT_INPUT_CHECK_NULLS, EEOP_AGG_PLAIN_PERGROUP_NULLCHECK, EEOP_AGG_PLAIN_TRANS_INIT_STRICT_BYVAL, -- cgit v1.2.3