其他分享
首页 > 其他分享> > HIVE高级(8):优化(8) Explain 查看执行计划

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 '\t';

// 创建小表
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 '\t';

// 创建 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 '\t';
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;

 

 

 

 

 

标签:string,查看,url,Explain,HIVE,int,bigint,click,bigtable
来源: https://www.cnblogs.com/qiu-hua/p/15143724.html