摘要:
外连接相比内连接过于耗时,本文记录其分析过程
参考:
https://en.wikipedia.org/wiki/Venn_diagram
查询SQL
外连接:
SELECTa.ROW_IDFROMc1md_bank_acct aLEFT JOIN (SELECTxx.account_id,xx.fiscal_date,xx.balanceFROM(SELECTaccount_id,MAX(fiscal_date) fiscal_dateFROMc1am_acct_dayWHEREdeleted_flag = '0'GROUP BYaccount_id) xINNER JOIN c1am_acct_day xx ONx.account_id = xx.account_idAND x.fiscal_date = xx.fiscal_dateWHERExx.deleted_flag = '0') c ONa.row_id = c.account_id;
执行计划分析:
{"query_block": {"select_id": 1,"cost_info": {"query_c