Hive表的分区与分桶

1.Hive分区表

Hive使用select语句进行查询的时候一般会扫描整个表内容,会消耗很多时间做没必要的工作。Hive可以在创建表的时候指定分区空间,这样在做查询的时候就可以很好的提高查询的效率。


创建分区表的语法:

create table tablename(
       name string
)partitioned by(key,type...);

示例

drop table if exists employees;
create table  if not exists employees(
       name string,
       salary float,
       subordinate array<string>,
       deductions map<string,float>,
       address struct<street:string,city:string,num:int>
) partitioned by (date_time string,type string)
row format delimited fields terminated by '\t'
collection items terminated by ','
map keys terminated by ':'
lines terminated by &
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值