From: Richard Guo <rguo@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Support "Right Semi Join" plan shapes
Date: Fri, 05 Jul 2024 00:29:54 +0000
Message-ID: <E1sPWpl-000LqW-IW@gemulon.postgresql.org> (raw)
Support "Right Semi Join" plan shapes
Hash joins can support semijoin with the LHS input on the right, using
the existing logic for inner join, combined with the assurance that only
the first match for each inner tuple is considered, which can be
achieved by leveraging the HEAP_TUPLE_HAS_MATCH flag. This can be very
useful in some cases since we may now have the option to hash the
smaller table instead of the larger.
Merge join could likely support "Right Semi Join" too. However, the
benefit of swapping inputs tends to be small here, so we do not address
that in this patch.
Note that this patch also modifies a test query in join.sql to ensure it
continues testing as intended. With this patch the original query would
result in a right-semi-join rather than semi-join, compromising its
original purpose of testing the fix for neqjoinsel's behavior for
semi-joins.
Author: Richard Guo
Reviewed-by: wenhui qiu, Alena Rybakina, Japin Li
Discussion: https://postgr.es/m/CAMbWs4_X1mN=ic+SxcyymUqFx9bB8pqSLTGJ-F=MHy4PW3eRXw@mail.gmail.com
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/aa86129e19d704afb93cb84ab9638f33d266ee9d
Modified Files
--------------
contrib/postgres_fdw/expected/postgres_fdw.out | 15 +-
src/backend/commands/explain.c | 3 +
src/backend/executor/nodeHashjoin.c | 15 +-
src/backend/optimizer/path/joinpath.c | 42 +++--
src/backend/optimizer/path/joinrels.c | 3 +
src/backend/optimizer/path/pathkeys.c | 3 +
src/backend/optimizer/prep/prepjointree.c | 6 +-
src/include/nodes/nodes.h | 9 +-
src/include/nodes/pathnodes.h | 6 +-
src/test/regress/expected/join.out | 27 ++--
src/test/regress/expected/partition_join.out | 216 +++++++++++++------------
src/test/regress/expected/select_parallel.out | 32 ++--
src/test/regress/expected/updatable_views.out | 6 +-
src/test/regress/sql/join.sql | 8 +-
14 files changed, 220 insertions(+), 171 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 using the --to and --cc options:
reply via email
To: pgsql-committers@postgresql.org
Cc: rguo@postgresql.org, pgsql-committers@lists.postgresql.org
Subject: Re: pgsql: Support "Right Semi Join" plan shapes
In-Reply-To: <E1sPWpl-000LqW-IW@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