[ https://issues.apache.org/jira/browse/CALCITE-6891?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17935653#comment-17935653 ]
Zhen Chen commented on CALCITE-6891: ------------------------------------ [~julianhyde] Yes, this rule tends to be used in CBO. I have push the pr in [4244|https://github.com/apache/calcite/pull/4244]. > Implement IntersectReorderRule > ------------------------------ > > Key: CALCITE-6891 > URL: https://issues.apache.org/jira/browse/CALCITE-6891 > Project: Calcite > Issue Type: Improvement > Reporter: Zhen Chen > Assignee: Zhen Chen > Priority: Major > > Do we need this rule? > from: > > {code:java} > LogicalIntersect(all=[false]) > LogicalProject(DEPTNO=[$7]) > LogicalFilter(condition=[>($7, 10)]) > LogicalTableScan(table=[[CATALOG, SALES, EMP(big)]]) > LogicalProject(DEPTNO=[$0]) > LogicalFilter(condition=[>($0, 5)]) > LogicalTableScan(table=[[CATALOG, SALES, DEPT(small)]]){code} > to > > > {code:java} > LogicalIntersect(all=[false]) > LogicalProject(DEPTNO=[$0]) > LogicalFilter(condition=[>($0, 5)]) > LogicalTableScan(table=[[CATALOG, SALES, DEPT(small)]]) > LogicalProject(DEPTNO=[$7]) > LogicalFilter(condition=[>($7, 10)]) > LogicalTableScan(table=[[CATALOG, SALES, EMP(big)]]) {code} > This rule put smaller inputs first. This helps reduce the size of > intermediate results. > -- This message was sent by Atlassian Jira (v8.20.10#820010)