欢迎投稿

今日深度:

hive的索引:,

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;

 

www.htsjk.Com true http://www.htsjk.com/hive/33915.html NewsArticle hive的索引:, hive的索引: 索引是数据库的一种标准技术,hive在0.7版本以后支持索引,只不过hive的索引的性能要比关系型数据库的差 优点:提高查询效率,避免全表扫描 缺点:冗余...
相关文章
    暂无相关文章
评论暂时关闭