Hive调优之unionall效率低的问题解决
在⼯作中有时候会⽤到union all来进⾏合并,但如果⽤到union all的个数⼤于2的时候,效率就会变低。此时可以⽤insert into 的⽅法将原来的sql拆成多个,实测效率可以提升50%。
代码⽰例:
--⽤union all
insert overwtite table xxxx
select a, b, c from table1
union all
select d, e, f from table2
union allsql中union多表合并
select h, i, j from table3
--替换成insert into
drop table if exists table xxxx;
insert into table xxxx
select a, b, c from table1;
insert into table xxxx
select d, e, f from table2;
insert into table xxxx
select h, i, j from table3;

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。