hive的索引:

hive的索引:


索引是数据库的一种标准技术,hive在0.7版本以后支持索引,只不过hive的索引的性能要比关系型数据库的差
优点:提高查询效率,避免全表扫描
缺点:冗余存储,加载数据较慢
索引文件的特点:索引数据有序,并且数据量较小

 

索引的参数(关键字)index


如何创建一个索引

create table if not exists text3
as
select * from text2
;

 

create index id_idx
on table text3(uid)
as 'compact' //数据文件的存储格式
with deferred rebuild//索引文件能够重建
;

 

修改索引
 

alter index id_idx
on text3 rebuild
;

查看索引
 

show index on text3;

创建联合索引
 

create index id_idx_uid_uname
on table text3(uid,uname)
as 'bitmap'
with deferred rebuild
;


select * from text2 where uid=95010 and uname like '%小涛';
select * from text3 where uid=95010 and uname like '%小涛';

删除索引
 

drop index id_idx on text3;

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值