Special-case executor expression steps for common combinations
Daniel Gustafsson <daniel@yesql.se>
From: Daniel Gustafsson <daniel@yesql.se>
To: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>,
Andres Freund <andres@anarazel.de>
Date: 2023-10-12T09:48:35Z
Lists: pgsql-hackers
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Add special case fast-paths for strict functions
- d35d32d7112b 18.0 landed
-
Replace EEOP_DONE with special steps for return/no return
- 8dd7c7cd0a26 18.0 landed
Attachments
- v1-0001-Add-fast-path-expression-steps-for-common-combina.patch (application/octet-stream) patch v1-0001
The attached patch adds special-case expression steps for common sets of steps
in the executor to shave a few cycles off during execution, and make the JIT
generated code simpler.
* Adds EEOP_FUNCEXPR_STRICT_1 and EEOP_FUNCEXPR_STRICT_2 for function calls of
strict functions with 1 or 2 arguments (EEOP_FUNCEXPR_STRICT remains used for
> 2 arguments).
* Adds EEOP_AGG_STRICT_INPUT_CHECK_ARGS_1 which is a special case for the
common case of one arg aggs.
* Replace EEOP_DONE with EEOP_DONE_RETURN and EEOP_DONE_NO_RETURN to be able to
skip extra setup for steps which are only interested in the side effects.
Stressing the EEOP_FUNCEXPR_STRICT_* steps specifically shows a 1.5%
improvement and pgbench over the branch shows a ~1% improvement in TPS (both
measured over 6 runs with outliers removed).
EEOP_FUNCEXPR_STRICT_* (10M iterations):
master : (7503.317, 7553.691, 7634.524)
patched : (7422.756, 7455.120, 7492.393)
pgbench:
master : (3653.83, 3792.97, 3863.70)
patched : (3743.04, 3830.02, 3869.80)
This patch was extracted from a larger body of work from Andres [0] aiming at
providing the necessary executor infrastructure for making JIT expression
caching possible. This patch, and more which are to be submitted, is however
separate in the sense that it is not part of the infrastructure, it's an
improvements on its own.
Thoughts?
--
Daniel Gustafsson
[0]: https://postgr.es/m/20191023163849.sosqbfs5yenocez3@alap3.anarazel.de