Hive索引

一.目的

  优化查询以及检索性能

二.创建索引

  create index index_user on table user(name)

  as 'org.apache.hadoop.hive.ql.index.compact.CompactIndexHandle' wiith deferred rebuild

  in table index_user_table;

  备注:

  as:指定索引器;

  in table:指定索引表,若不指定默认生成在default_user_t1_index_表中;

三.查询索引

  show index on user;

四.重建索引

  alter index index_user on user rebuild;

  注意:创建索引之后必须重建索引才能生效!

五.删除索引

  drop index if exists index_user on user;

posted @ 2019-06-17 17:07  云山之巅  阅读(759)  评论(0编辑  收藏  举报