子查询展开(subquery unnesting)

    1. Query OK, 0 rows affected (0.09 sec)
    2. obclient> create table t2(a int primary key, b int, c int);
    3. Query OK, 0 rows affected (0.09 sec)
    4. --- 有依赖关系的子查询被展开改写成连接
    5. obclient> explain select * from t1 where t1.a in (select t2.b from t2 where t2.c = t1.c);
    6. | ============================================
    7. |0 |MERGE JOIN | |9703 |215436|
    8. |1 | TABLE SCAN |t1 |100000 |64066 |
    9. |2 | SORT | |10001 |129621|
    10. |3 | SUBPLAN SCAN |VIEW1|10001 |111242|
    11. |4 | HASH DISTINCT| |10001 |109862|
    12. |5 | TABLE SCAN |t2 |100000 |64066 |
    13. ============================================
    14. Outputs & filters:
    15. 0 - output([t1.a], [t1.b], [t1.c]), filter(nil),
    16. equal_conds([t1.a = VIEW1.t2.b], [VIEW1.t2.c = t1.c]), other_conds(nil)
    17. 1 - output([t1.c], [t1.a], [t1.b]), filter(nil),
    18. access([t1.c], [t1.a], [t1.b]), partitions(p0)
    19. 2 - output([VIEW1.t2.b], [VIEW1.t2.c]), filter(nil), sort_keys([VIEW1.t2.b, ASC], [VIEW1.t2.c, ASC])
    20. 3 - output([VIEW1.t2.b], [VIEW1.t2.c]), filter(nil),
    21. access([VIEW1.t2.b], [VIEW1.t2.c])
    22. 4 - output([t2.b], [t2.c]), filter(nil),
    23. distinct([t2.b], [t2.c])