Special-case executor expression steps for common combinations

From: Daniel Gustafsson <daniel(at)yesql(dot)se>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Andres Freund <andres(at)anarazel(dot)de>
Subject: Special-case executor expression steps for common combinations
Date: 2023-10-12 09:48:35
Message-ID: 415721CE-7D2E-4B74-B5D9-1950083BA03E@yesql.se
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

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)

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.


Daniel Gustafsson

[0]: https://postgr.es/m/20191023163849.sosqbfs5yenocez3@alap3.anarazel.de

Attachment Content-Type Size
v1-0001-Add-fast-path-expression-steps-for-common-combina.patch application/octet-stream 18.4 KB


Browse pgsql-hackers by date

  From Date Subject
Next Message Alexander Lakhin 2023-10-12 10:00:01 Re: cataloguing NOT NULL constraints
Previous Message Amit Kapila 2023-10-12 09:28:48 Re: [PoC] pg_upgrade: allow to upgrade publisher node