博客地址:
https://hortonworks.com/blog/100x-faster-hive/
https://hortonworks.com/blog/orcfile-in-hdp-2-better-compression-better-performance/
https://hortonworks.com/blog/5-ways-make-hive-queries-run-faster/
五个调优hive的建议:
1.使用TEZ引擎
使用TEZ引擎代替原有的MR引擎,提高计算速度(什么是TEZ请自行百度)
如何开启
set hive.execution.engine = tez;
这样就可以使用TEZ引擎了
注:CDH集群并不支持tez
2.使用ORC存储格式
主要思想是 predicate push-Down and compression
使用ORC文件作为底层存储,可以使你Hive的查询响应的更快.
例子
SELECT A.customerID, A.name, A.age, A.address join
B.role, B.department, B.salary
ON A.customerID=B.customerID;
这个SQL语句如果用Hive本身默认的存储格式text的话,可能会耗费更长时间,如果使用orc文件格式的话,可能会查询的非常快
如何使用 ORC
CREATE TABLE A_ORC (
customerID int, name string, age int, address string
) STORED AS ORC tblproperties (“orc.compress" = “SNAPPY”);
INSERT INTO TABLE A_ORC SELECT * FROM A;</