From: | Japin Li <japinli(at)hotmail(dot)com> |
---|---|
To: | Richard Guo <guofenglinux(at)gmail(dot)com> |
Cc: | Alena Rybakina <lena(dot)ribackina(at)yandex(dot)ru>, wenhui qiu <qiuwenhuifx(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, vignesh C <vignesh21(at)gmail(dot)com> |
Subject: | Re: Support "Right Semi Join" plan shapes |
Date: | 2024-06-25 00:51:03 |
Message-ID: | ME3P282MB31663E0BB88B01340E3CAB56B6D52@ME3P282MB3166.AUSP282.PROD.OUTLOOK.COM |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Mon, 24 Jun 2024 at 17:59, Richard Guo <guofenglinux(at)gmail(dot)com> wrote:
> Thank you for reviewing.
>
> On Mon, Jun 24, 2024 at 1:27 PM Li Japin <japinli(at)hotmail(dot)com> wrote:
>> + /*
>> + * For now we do not support RIGHT_SEMI join in mergejoin or nestloop
>> + * join.
>> + */
>> + if (jointype == JOIN_RIGHT_SEMI)
>> + return;
>> +
>>
>> How about adding some reasons here?
>
> I've included a brief explanation in select_mergejoin_clauses.
>
Thank you for updating the patch.
>> + * this is a right-semi join, or this is a right/right-anti/full join and
>> + * there are nonmergejoinable join clauses. The executor's mergejoin
>>
>> Maybe we can put the right-semi join together with the right/right-anti/full
>> join. Is there any other significance by putting it separately?
>
> I don't think so. The logic is different: for right-semi join we will
> always set *mergejoin_allowed to false, while for right/right-anti/full
> join it is set to false only if there are nonmergejoinable join clauses.
>
Got it. Thanks for the explanation.
>> Maybe the following comments also should be updated. Right?
>
> Correct. And there are a few more places where we need to mention
> JOIN_RIGHT_SEMI, such as in reduce_outer_joins_pass2 and in the comment
> for SpecialJoinInfo.
>
>
> I noticed that this patch changes the plan of a query in join.sql from
> a semi join to right semi join, compromising the original purpose of
> this query, which was to test the fix for neqjoinsel's behavior for
> semijoins (see commit 7ca25b7d).
>
> --
> -- semijoin selectivity for <>
> --
> explain (costs off)
> select * from int4_tbl i4, tenk1 a
> where exists(select * from tenk1 b
> where a.twothousand = b.twothousand and a.fivethous <> b.fivethous)
> and i4.f1 = a.tenthous;
>
> So I've changed this test case a bit so that it is still testing what it
> is supposed to test.
>
> In passing, I've also updated the commit message to clarify that this
> patch does not address the support of "Right Semi Join" for merge joins.
>
Tested and looks good to me!
--
Regrads,
Japin Li
From | Date | Subject | |
---|---|---|---|
Next Message | Kyotaro Horiguchi | 2024-06-25 01:03:39 | Re: 001_rep_changes.pl fails due to publisher stuck on shutdown |
Previous Message | Joel Jacobson | 2024-06-24 23:21:14 | Re: Add pg_get_acl() function get the ACL for a database object |