pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Paquier <michael@paquier.xyz>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Add back SQLValueFunction for SQL keywords
Date: Wed, 17 May 2023 01:23:21 +0000
Message-ID: <E1pz5sw-000GF9-7C@gemulon.postgresql.org> (raw)

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(-)



Message-ID: <E1pz5sw-000GF9-7C@gemulon.postgresql.org>
Permalink:  ../E1pz5sw-000GF9-7C@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1pz5sw-000GF9-7C@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: michael@paquier.xyz, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Add back SQLValueFunction for SQL keywords
  In-Reply-To: <E1pz5sw-000GF9-7C@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox