【发布时间】:2015-09-18 16:08:14
【问题描述】:
我的数据如下所示:
Wban Number, YearMonthDay, Time, Hourly Precip
03011,20060301,0050,0
现在这个文件有超过 100 万行。所以我创建了一个包含分区(在 wbannumber 上)和存储桶(在 yearmonthday 上)的表:
create table hpd_bkt
(
YearMonthDay INT,
Time INT,
HourlyPrecip float
)
partitioned by (wbannum int)
clustered by (yearmonthday) sorted by (yearmonthday) into 31 buckets
row format delimited
fields terminated by ','
lines terminated by '\n'
stored as textfile;
然后:
insert overwrite table hpd_bkt partition(wbannum)
Select yearmonthday,time,hourlyprecip,wbannum from hpd;
现在我使用以下查询来获取不同的 wbannumbers(用于分区+桶表):
select count(distinct wbannum) from hpd_bkt;
总共需要 103 秒来处理这个(13 秒 CPU 时间)
但是从普通数据表中查询时,总共需要 21 秒(8 秒 CPU 时间)
谁能解释一下,我在这里可能做错了什么?
【问题讨论】:
标签: hadoop mapreduce hive hbase apache-pig