zoukankan      html  css  js  c++  java
  • HIVE高级(8):优化(8) Explain 查看执行计划(二)

    1 创建测试用表

    1)建大表、小表和 JOIN 后表的语句
    // 创建大表
    create table bigtable(id bigint, t bigint, uid string, keyword string, 
    url_rank int, click_num int, click_url string) row format delimited 
    fields terminated by '	';
    
    // 创建小表
    create table smalltable(id bigint, t bigint, uid string, keyword string, 
    url_rank int, click_num int, click_url string) row format delimited 
    fields terminated by '	';
    
    // 创建 JOIN 后表
    create table jointable(id bigint, t bigint, uid string, keyword string, 
    url_rank int, click_num int, click_url string) row format delimited 
    fields terminated by '	';
    2)分别向大表和小表中导入数据
    hive (default)> load data local inpath '/opt/module/data/bigtable' into 
    table bigtable;
    hive (default)> load data local inpath '/opt/module/data/smalltable' into 
    table smalltable;

    2 基本语法

    EXPLAIN [EXTENDED | DEPENDENCY | AUTHORIZATION] query-sql

    3 案例实操

    1)查看下面这条语句的执行计划
    hive (default)> explain select * from bigtable;
    hive (default)> explain select click_url, count(*) ct from bigtable group 
    by click_url;
    2)查看详细执行计划
    hive (default)> explain extended select * from bigtable;
    hive (default)> explain extended select click_url, count(*) ct from 
    bigtable group by click_url;

    本文来自博客园,作者:秋华,转载请注明原文链接:https://www.cnblogs.com/qiu-hua/p/15143724.html

  • 相关阅读:
    shell中单引号、双引号、反斜杠简说
    shell脚本
    求素数
    SqlBulkCopy高效写入数据库Demo
    地图面面观之百望山
    FileUpload控件客户端验证
    如何将shapefile进行拆分
    Python 字符串操作
    如何重装oracle
    资料
  • 原文地址:https://www.cnblogs.com/qiu-hua/p/15143724.html
Copyright © 2011-2022 走看看