1.使用explain 和 explain extended
expain select * from dual;
expain extended select * from dual;
2.限制調(diào)整 limit
在使用Limit 時(shí)只輸出了指定行數(shù)嘁捷,但在很多情況下Limit語(yǔ)句還是會(huì)執(zhí)行整個(gè)語(yǔ)句舞吭,再返回部分結(jié)果硝烂,可以設(shè)置抽樣,避免這種情況。
<property>
<name>hive.limit.optimize.enable</name>
<value>true</value>
</property>
<property>
<name>hive.limit.row.max.size</name>
<value>10000</value>
</property>
<property>
<name>hive.limit.row.min.size</name>
<value>10</value>
</property>
缺點(diǎn)
一些數(shù)據(jù)永遠(yuǎn)不會(huì)被處理,就是有后續(xù)處理的悬而,因?yàn)榍耙浑A段把一些數(shù)據(jù)排除在外了。
例如: 有reduce階段锭汛,join和group by,還有大部分聚合函數(shù)笨奠。
3.本地模式
永久配置:
## hive-site.xml
<property>
<name>hive.exec.mode.local.auto</name>
<value>true</value>
</property>
啟動(dòng)時(shí):
$ hive hive.exec.mode.local.auto=true
執(zhí)行過程臨時(shí)啟用本地模式
長(zhǎng)呀袭蝗,不想打,多幾個(gè) set 用的不多