pgsql: Add back SQLValueFunction for SQL keywords - Mailing list pgsql-committers

From Michael Paquier
Subject pgsql: Add back SQLValueFunction for SQL keywords
Date
Msg-id E1pz5sw-000GF9-7C@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Add back SQLValueFunction for SQL keywords

This is equivalent to a revert of f193883 and fb32748, with the addition
that the declaration of the SQLValueFunction node needs to gain a couple
of node_attr for query jumbling.  The performance impact of removing the
function call inlining is proving to be too huge for some workloads
where these are used.  A worst-case test case of involving only simple
SELECT queries with a SQL keyword is proving to lead to a reduction of
10% in TPS via pgbench and prepared queries on a high-end machine.

None of the tests I ran back for this set of changes saw such a huge
gap, but Alexander Lakhin and Andres Freund have found that this can be
noticeable.  Keeping the older performance would mean to do more
inlining in the executor when using COERCE_SQL_SYNTAX for a function
expression, similarly to what SQLValueFunction does.  This requires more
redesign work and there is little time until 16beta1 is released, so for
now reverting the change is the best way forward, bringing back the
previous performance.

Bump catalog version.

Reported-by: Alexander Lakhin
Discussion: https://postgr.es/m/b32bed1b-0746-9b20-1472-4bdc9ca66d52@gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/d8c3106bb60e4f87be595f241e173ba3c2b7aa2c

Modified Files
--------------
src/backend/catalog/system_functions.sql  |  26 ------
src/backend/executor/execExpr.c           |  11 +++
src/backend/executor/execExprInterp.c     |  73 +++++++++++++++++
src/backend/jit/llvm/llvmjit_expr.c       |   6 ++
src/backend/jit/llvm/llvmjit_types.c      |   1 +
src/backend/nodes/nodeFuncs.c             |  32 +++++++-
src/backend/optimizer/path/costsize.c     |   1 +
src/backend/optimizer/util/clauses.c      |  39 +++++++--
src/backend/parser/gram.y                 |  89 +++++++--------------
src/backend/parser/parse_expr.c           |  60 ++++++++++++++
src/backend/parser/parse_target.c         |  43 ++++++++++
src/backend/utils/adt/date.c              |  75 ++++++++---------
src/backend/utils/adt/ruleutils.c         | 128 +++++++++++++++---------------
src/backend/utils/adt/timestamp.c         |  66 +++++++--------
src/include/catalog/catversion.h          |   2 +-
src/include/catalog/pg_proc.dat           |  26 ------
src/include/executor/execExpr.h           |   8 ++
src/include/nodes/primnodes.h             |  43 ++++++++++
src/include/utils/date.h                  |   4 +
src/include/utils/timestamp.h             |   4 +
src/test/regress/expected/expressions.out |   2 +-
src/test/regress/sql/expressions.sql      |   2 +-
src/tools/pgindent/typedefs.list          |   2 +
23 files changed, 473 insertions(+), 270 deletions(-)


pgsql-committers by date:

Previous
From: Daniel Gustafsson
Date:
Subject: Re: pgsql: Refactor background psql TAP functions
Next
From: Daniel Gustafsson
Date:
Subject: Re: pgsql: Refactor background psql TAP functions