Support "Right Semi Join" plan shapes

From: Richard Guo <guofenglinux(at)gmail(dot)com>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Support "Right Semi Join" plan shapes
Date: 2023-04-18 09:07:34
Message-ID: CAMbWs4_X1mN=ic+SxcyymUqFx9bB8pqSLTGJ-F=MHy4PW3eRXw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

In thread [1] which discussed 'Right Anti Join', Tom once mentioned
'Right Semi Join'. After a preliminary investigation I think it is
beneficial and can be implemented with very short change. With 'Right
Semi Join', what we want to do is to just have the first match for each
inner tuple. For HashJoin, after scanning the hash bucket for matches
to current outer, we just need to check whether the inner tuple has been
set match and skip it if so. For MergeJoin, we can do it by avoiding
restoring inner scan to the marked tuple in EXEC_MJ_TESTOUTER, in the
case when new outer tuple == marked tuple.

As that thread is already too long, fork a new thread and attach a patch
used for discussion. The patch implements 'Right Semi Join' for
HashJoin.

[1]
https://www.postgresql.org/message-id/CAMbWs4_eChX1bN%3Dvj0Uzg_7iz9Uivan%2BWjjor-X87L-V27A%2Brw%40mail.gmail.com

Thanks
Richard

Attachment Content-Type Size
v1-0001-Support-Right-Semi-Join-plan-shapes.patch application/octet-stream 23.4 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Ken Kato 2023-04-18 09:08:23 Tab completion for GRANT MAINTAIN
Previous Message Jim Jones 2023-04-18 08:58:11 Re: Adding argument names to aggregate functions