HIVE脚本优化
来源:互联网 发布:呼叫器软件设置 编辑:程序博客网 时间:2024/05/28 23:21
1.写HIVE脚本时,要善于使用multi-insert语法
insert into(或者overwrite) table1 partition(dt = ‘2017-11-02’)
select a, b
from app.app_m04_order_info //增量表
where dt >= sysdate(-2) ;
insert into(或者overwrite) table2 partition(dt = ‘2017-11-02’)
select a, b
from app.app_m04_order_info //增量表
where dt >= sysdate(-2) ;
Hive会进行解析,分成两个job 分别执行,因为使用两个语句。
优化方案:
使用multi-insert语句,实现一次读写,写入两个表中
from app.app_m04_order_info
insert into(或者overwrite) table1 partition(dt = ‘2017-11-02’)
select a,b
where dt >= sysdate(-2)
insert into(或者overwrite) table2 partition (dt = ‘2017-11-03’)
select c
where dt >= sysdate(-1)
2. union all语句,不同表的union all 会多次读写,同一张表的union all,只需要读取数据一次Map,实现不同条件过滤数据,推送到不同的地方。
select a,b
from app.app_m04_order_info1
where dt >= sysdate(-2)
union all
select a,b
from app.app_m04_order_info2
where dt >= sysdate(-2)
select a,b from app.app_m04_order_info1 where dt >= sysdate(-2) union all select a,b from app.app_m04_order_info1 where dt >= sysdate(-3)
- HIVE脚本优化
- hive 脚本
- Hive 脚本
- Hive脚本
- hive脚本
- 【hive】hive优化
- hive(二)--hive优化
- Hive 12、Hive优化
- Hive优化
- hive优化
- hive优化
- Hive 优化
- Hive优化
- Hive优化
- Hive优化
- hive优化
- hive优化
- hive 优化
- delphi FMX gridlayout与gridpannellayout
- Shell之判断程序是否运行-yellowcong
- asp.net页面生命周期
- Titan Graph DataBase 研究 (二)----Titan Server 发布
- 循环神经网络(RNN, Recurrent Neural Networks)
- HIVE脚本优化
- CSS 框架 Bulma 教程
- Python 编码规范(Google)
- 使用LocalDate计算两个日期相差多少天
- 人工智能语聊的相关原理学习(一):Huffman编码
- Yii框架 AR 与 添加表单小部件
- Luban(鲁班) —— Android图片压缩工具,仿微信朋友圈压缩策略。
- 大小端转换定义结构体的技巧
- 安装libmemached