1、尽量不用 select *
2、输入文件不要是大量的小文件,hive默认的分片是128M小文件可以先合并成大文件
对于 group by 引起的倾斜,优化措施
set hive.map.aggr=true;
set hive.groupby.skewindata=true
count distinct 优化 可以通过先 group by 再count的方式来优化
select count(distinct user) from some_table
select count(*) from ( select user from some_table group by user) tmp;
大表join大表引发的倾斜
set hive.optimise.skewinfo=table_B:(字段)[("0")("1")];
set hive.optimise.skewjoin=true;