Hive 调优

	1.explain
		使用explain查看查询计划
		hive>explain [extended] select count(*) from customers ;
		hive>explain select t.name , count(*) from (select a.name ,b.id,b.orderno from customers a ,orders b where a.id = b.cid) t group by t.name ;

		//设置limit优化测,避免全部查询.
		hive>set hive.limit.optimize.enable=true

		//本地模式
		$hive>set mapred.job.tracker=local;			
		$hive>set hive.exec.mode.local.auto=true	//自动本地模式,测试


		//并行执行,同时执行不存在依赖关系的阶段。
		$hive>set hive.exec.parallel=true			

		//严格模式,
		$hive>set hive.mapred.mode=strict			
                //1.分区表必须指定分区进行查询
		//2.order by时必须使用limit子句。
		//3.不允许笛卡尔积.

		//设置MR的数量
		hive> set hive.exec.reducers.bytes.per.reducer=750000000;	//设置reduce处理的字节数。

		//JVM重用
		$hive>set mapreduce.job.jvm.numtasks=1		//-1没有限制,使用大量小文件。

		//UDF
		//User define function,用户自定义函数
		//current_database(),current_user();

		//显式所有函数
		$hive>show functions;
		$hive>select array(1,2,3) ;

		//显式指定函数帮助
		$hive>desc function current_database();

		//表生成函数,多行函数。
		$hive>explode(str,exp);			//按照exp切割str.

自定义函数

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值