Hive Tuning(四) 从查询计划看hive.auto.convert.join的好处

时间:2023-03-09 15:34:35
Hive Tuning(四)  从查询计划看hive.auto.convert.join的好处

今天我们来讲一下如何看懂Hive的查询计划。

hive的执行计划包括三部分

– Abstract syntax tree – 可以直接忽略 
– Stage dependencies – 依赖
– Stage plans – hive如何执行任务的信息.

Hive Tuning(四)  从查询计划看hive.auto.convert.join的好处

下面还是以一个案例作为说明

Hive Tuning(四)  从查询计划看hive.auto.convert.join的好处

设置自动连接为false的话,要走5步。

Hive Tuning(四)  从查询计划看hive.auto.convert.join的好处

4 Map Reduces tells you something is not right. 
 
    Stage:    Stage-1   
                Map    Reduce   
    Stage:    Stage-2   
                Map    Reduce   
    Stage:    Stage-3   
                Map    Reduce   
    Stage:    Stage-4   
                Map    Reduce

设置自动连接为true就只有4步

Hive Tuning(四)  从查询计划看hive.auto.convert.join的好处

Only 2 Map Reduces

Stage:    Stage-8   
                Map    Reduce   
    Stage:    Stage-4   
                Map    Reduce

Hive Tuning(四)  从查询计划看hive.auto.convert.join的好处

hive直接就加载了要做连接的表,client和path表,其中client表做了过滤,剩下的map/reduce是用来连接和排序的。