From: Alexander Korotkov <akorotkov@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Allow usage of match_orclause_to_indexcol() for joins
Date: Tue, 04 Feb 2025 21:22:42 +0000
Message-ID: <E1tfQNW-005O5w-6g@gemulon.postgresql.org> (raw)
Allow usage of match_orclause_to_indexcol() for joins
This commit allows transformation of OR-clauses into SAOP's for index scans
within nested loop joins. That required the following changes.
1. Make match_orclause_to_indexcol() and group_similar_or_args() understand
const-ness in the same way as match_opclause_to_indexcol(). This
generally makes our approach more uniform.
2. Make match_join_clauses_to_index() pass OR-clauses to
match_clause_to_index().
3. Also switch match_join_clauses_to_index() to use list_append_unique_ptr()
for adding clauses to *joinorclauses. That avoids possible duplicates
when processing the same clauses with different indexes. Previously such
duplicates were elimited in match_clause_to_index(), but now
group_similar_or_args() each time generates distinct copies of grouped
OR clauses.
Discussion: https://postgr.es/m/CAPpHfdv%2BjtNwofg-p5z86jLYZUTt6tR17Wy00ta0dL%3DwHQN3ZA%40mail.gmail.com
Reviewed-by: Andrei Lepikhov <lepihov@gmail.com>
Reviewed-by: Alena Rybakina <a.rybakina@postgrespro.ru>
Reviewed-by: Pavel Borisov <pashkin.elfe@gmail.com>
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/627d63419e22054551327216d2b2de3e6977fade
Modified Files
--------------
src/backend/optimizer/path/indxpath.c | 70 ++++++++++++++++------------
src/test/regress/expected/create_index.out | 32 +++++++++++++
src/test/regress/expected/join.out | 51 +++++++++++++++++---
src/test/regress/expected/partition_join.out | 12 ++---
src/test/regress/sql/create_index.sql | 9 ++++
src/test/regress/sql/join.sql | 18 ++++++-
6 files changed, 150 insertions(+), 42 deletions(-)
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-committers@postgresql.org
Cc: akorotkov@postgresql.org
Subject: Re: pgsql: Allow usage of match_orclause_to_indexcol() for joins
In-Reply-To: <E1tfQNW-005O5w-6g@gemulon.postgresql.org>
References: <E1tfQNW-005O5w-6g@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