hive性能调优

1. 使用EXPLAIN

通过EXPLAIN功能,可以帮助我们了解如何将查询转化成MapReduce任务的。

 

1、使用explain查看hive如何将查询转化成MapReduce任务的

1.1 创建表

create table onecol(number int)

1.2 初始化数据并加载

[hadoop@mycluster ~]$ vi onecol 

1

2

3

4

5

 

hive (default)> load data local inpath '/home/hadoop/onecol' overwrite into table onecol;

 

1.3 通过explain查看

hive (default)> explain select sum(number) from onecol;

OK

Explain

STAGE DEPENDENCIES:

  Stage-1 is a root stage

  Stage-0 is a root stage

 

STAGE PLANS:

  Stage: Stage-1

    Map Reduce

      Map Operator Tree:

          TableScan

            alias: onecol

            Statistics: Num rows: 2 Data size: 10 Basic stats: COMPLETE Column stats: NONE

            Select Operator

              expressions: number (type: int)

              outputColumnNames: number

              Statistics: Num rows: 2 Data size: 10 Basic stats: COMPLETE Column stats: NONE

              Group By Operator

                aggregations: sum(number)

                mode: hash

                outputColumnNames: _col0

                Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: NONE

                Reduce Output Operator

                  sort order: 

                  Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: NONE

                  value expressions: _col0 (type: bigint)

      Reduce Operator Tree:

        Group By Operator

          aggregations: sum(VALUE._col0)

          mode: mergepartial

          outputColumnNames: _col0

          Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: NONE

          Select Operator

            expressions: _col0 (type: bigint)

            outputColumnNames: _col0

            Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: NONE

            File Output Operator

              compressed: false

              Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: NONE

              table:

                  input format: org.apache.hadoop.mapred.TextInputFormat

                  output format: org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat

                  serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe

 

  Stage: Stage-0

    Fetch Operator

      limit: -1

 

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值