hive 建立索引

2021-10-01 02:57:43 字數 1010 閱讀 9177

索引是hive0.7之後才有的功能,建立索引需要評估其合理性,因為建立索引也是要磁碟空間,維護起來也是需要代價的

create

index idx_user_phone on

table user_phone_with_phone_message(user_phone)

as'org.apache.hadoop.hive.ql.index.compact.compactindexhandler'

with deferred rebuild

intable idx_user_phone_with_phone_message;

idx_user_phone: 索引名字

user_phone_with_phone_message:要建立索引的原始表

user_phone:索引字段

idx_user_phone_with_phone_message:建立索引後的表

org.apache.hadoop.hive.ql.

index

.compact.compactindexhandler :建立索引需要的實現類

alter

index idx_user_phone on user_phone_with_phone_message rebuild;

idx_user_phone:建立索引後的表

user_phone_with_phone_message:要建立索引的原始表

select

*from idx_user_phone_with_phone_message;

drop

index idx_user_phone on user_phone_with_phone_message;

show

index

on user_phone_with_phone_message

建立索引

hive 建立索引

索引是hive0.7之後才有的功能,建立索引需要評估其合理性,因為建立索引也是要磁碟空間,維護起來也是需要代價的 create index idx user phone on table user phone with phone message user phone as org.apache.h...

2 2 2Hive建立索引

hive建立索引 一 意義 索引是標準的資料庫技術,使用者可以在某些列上建立索引來加速某些操作,給乙個表建立的索引資料被儲存在另外的表中。使用者可以使用 explain 語法來分析 hiveql 語句是否可以使用索引來提公升使用者查詢的效能。索引需要更多的磁碟空間,並且建立維護索引也會有一定的代價。...

Hive索引的操作

源表 create table bak name string,id string,phone string,card num bigint,email string,addr string partitioned by time string row format delimited fields...