Re: Removing Self Joins
“Multi-join” is a misnomer. It is a data structure that LoptOptimizeJoinRule uses to pull together 2 or more relations (1 or more joins) and act on all of them simultaneously.
So, it should be able to handle your case.
> On May 19, 2018, at 10:13 AM, Atri Sharma <atri.jiit@xxxxxxxxx> wrote:
> Hi All,
> I am trying queries of the form:
> select * from \"scott\".EMP\n"
> + "e join (select * from \"scott\".EMP f where f.DEPTNO = 10)
> q on e.empno = q.empno
> I saw that an EnumerableMergeJoin is added on top of the scans where
> the join can be removed. I see findRemovableSelfJoins in
> LopOptimizeJoinRule which removes these exact cases, but I am not
> clear on how/where this rule will be fired for a query of above type.
> Is the said rule only applicable for multi joins? If so, is it
> worthwhile to add a rule for single join queries as well?