相同,执行计划完全一样,都是扫描大表时加上限制条件,然后去做关联
数据量:b:55 a:19321755
explain select count(1)
from stg_data.ODS_NKG_SIMPLEAGENTINFO b
left join [SHUFFLE] stg_data.ODS_NKG_FUNDINFO a
on a.FUNDID=b.FUNDID and a.custid=1100020376
+------------------------------------------------------------------------------------+
| Explain String |
+------------------------------------------------------------------------------------+
| Max Per-Host Resource Reservation: Memory=34.00MB |
| Per-Host Resource Estimates: Memory=2.08GB |
| WARNING: The following tables are missing relevant table and/or column statistics. |
| stg_data.ods_nkg_fundinfo, stg_data.ods_nkg_simpleagentinfo |
| |
| PLAN-ROOT SINK |
| | |
| 07:AGGREGATE [FINALIZE] |
| | output: count:merge(*) |
| | |
| 06:EXCHANGE [UNPARTITIONED] |
| | |
| 03:AGGREGATE |
| | output: count(*) |
| | |
| 02:HASH JOIN [LEFT OUTER JOIN, PARTITIONED] |
| | hash predicates: b.FUNDID = a.FUNDID |
| | |
| |--05:EXCHANGE [HASH(a.FUNDID)] |
| | | |
| | 01:SCAN HDFS [stg_data.ods_nkg_fundinfo a] |
| | partitions=54/54 files=54 size=758.66MB |
| | predicates: a.custid = 1100020376 |
| | |
| 04:EXCHANGE [HASH(b.FUNDID)] |
| | |
| 00:SCAN HDFS [stg_data.ods_nkg_simpleagentinfo b] |
| partitions=55/56 files=55 size=297.93KB |
+------------------------------------------------------------------------------------+
explain select count(1)
from stg_data.ODS_NKG_SIMPLEAGENTINFO b
left join [SHUFFLE] (select * from stg_data.ODS_NKG_FUNDINFO where custid=1100020376) a
on a.FUNDID=b.FUNDID
+------------------------------------------------------------------------------------+
| Explain String |
+------------------------------------------------------------------------------------+
| Max Per-Host Resource Reservation: Memory=34.00MB |
| Per-Host Resource Estimates: Memory=2.08GB |
| WARNING: The following tables are missing relevant table and/or column statistics. |
| stg_data.ods_nkg_fundinfo, stg_data.ods_nkg_simpleagentinfo |
| |
| PLAN-ROOT SINK |
| | |
| 07:AGGREGATE [FINALIZE] |
| | output: count:merge(*) |
| | |
| 06:EXCHANGE [UNPARTITIONED] |
| | |
| 03:AGGREGATE |
| | output: count(*) |
| | |
| 02:HASH JOIN [LEFT OUTER JOIN, PARTITIONED] |
| | hash predicates: b.FUNDID = stg_data.ods_nkg_fundinfo.fundid |
| | |
| |--05:EXCHANGE [HASH(stg_data.ods_nkg_fundinfo.fundid)] |
| | | |
| | 01:SCAN HDFS [stg_data.ods_nkg_fundinfo] |
| | partitions=54/54 files=54 size=758.66MB |
| | predicates: custid = 1100020376 |
| | |
| 04:EXCHANGE [HASH(b.FUNDID)] |
| | |
| 00:SCAN HDFS [stg_data.ods_nkg_simpleagentinfo b] |
| partitions=55/56 files=55 size=297.93KB |
+------------------------------------------------------------------------------------+