osdir.com

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Removing Self Joins


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?

Regards,

Atri