git.postgresql.org Git - postgresql.git/commit

git projects / postgresql.git / commit
? search:
summary | shortlog | log | commit | commitdiff | tree
(parent: 75a47b6) | patch
Transform OR clauses to ANY expression
Sun, 7 Apr 2024 22:27:28 +0000 (01:27 +0300)
Sun, 7 Apr 2024 22:27:52 +0000 (01:27 +0300)
commit 72bd38cc99a15da6f97373fae98027c908c398ea
Transform OR clauses to ANY expression

Replace (expr op C1) OR (expr op C2) ... with expr op ANY(ARRAY[C1, C2, ...])
on the preliminary stage of optimization when we are still working with the
expression tree.

Here Cn is a n-th constant expression, 'expr' is non-constant expression, 'op'
is an operator which returns boolean result and has a commuter (for the case
of reverse order of constant and non-constant parts of the expression,
like 'Cn op expr').

Sometimes it can lead to not optimal plan. This is why there is a
or_to_any_transform_limit GUC. It specifies a threshold value of length of
arguments in an OR expression that triggers the OR-to-ANY transformation.
Generally, more groupable OR arguments mean that transformation will be more
likely to win than to lose.

Discussion: https://postgr.es/m/567ED6CA.2040504%40sigaev.ru
Author: Alena Rybakina <lena.ribackina@yandex.ru>
Author: Andrey Lepikhov <a.lepikhov@postgrespro.ru>
Reviewed-by: Peter Geoghegan <pg@bowt.ie>
Reviewed-by: Ranier Vilela <ranier.vf@gmail.com>
Reviewed-by: Alexander Korotkov <aekorotkov@gmail.com>
Reviewed-by: Robert Haas <robertmhaas@gmail.com>
Reviewed-by: Jian He <jian.universality@gmail.com>
14 files changed:
doc/src/sgml/config.sgml diff | blob | blame | history
src/backend/nodes/queryjumblefuncs.c diff | blob | blame | history
src/backend/optimizer/prep/prepqual.c diff | blob | blame | history
src/backend/utils/misc/guc_tables.c diff | blob | blame | history
src/backend/utils/misc/postgresql.conf.sample diff | blob | blame | history
src/include/nodes/queryjumble.h diff | blob | blame | history
src/include/optimizer/optimizer.h diff | blob | blame | history
src/test/regress/expected/create_index.out diff | blob | blame | history
src/test/regress/expected/join.out diff | blob | blame | history
src/test/regress/expected/partition_prune.out diff | blob | blame | history
src/test/regress/sql/create_index.sql diff | blob | blame | history
src/test/regress/sql/join.sql diff | blob | blame | history
src/test/regress/sql/partition_prune.sql diff | blob | blame | history
src/tools/pgindent/typedefs.list diff | blob | blame | history
This is the main PostgreSQL git repository.
RSS Atom

AltStyle によって変換されたページ (->オリジナル) /