0
我的數據看起來像以下:爲什麼分區+分段花費的時間比從普通表查詢花費的時間更長?
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秒(CPU時間爲8秒)
任何人都可以解釋,我可能在這裏做錯了什麼?
因此,對於分區和分區,初始數據加載需要時間,是嗎? –
是的它的數據轉換(完整複製)執行重新安排數據。 –