You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hive.apache.org by saquib khan <sk...@gmail.com> on 2014/04/07 20:26:11 UTC

Indexes in hive

Dear Friends,

I have created the indexes but I am not able to use them. Does hive have an
index optimizer?

For a simple query in Oracle/Postgres, when we do EXPLAIN it gives the
Query Plan with indexes but with Hive it does not show me the indexes. How
can we make sure that the indexes are being used?


Table:
CREATE TABLE VT_DEMOGRAPHY_INFO (PID int, HID int, AGE int, GENDER int,
ZIPCODE string, BLOCKGROUPID string, LONGITUDE string, LATTITUDE string,
COUNTY string) PARTITIONED BY (COUNTYID string) row format delimited fields
terminated by '|' stored as textfile;

I have created indexes on PID and BLOCKGROUPID

CREATE INDEX se_vt_pid ON TABLE se_vt(pid) AS
'org.apache.hadoop.hive.ql.index.compact.CompactIndexHandler' WITH DEFERRED
REBUILD;
ALTER INDEX se_vt_pid ON se_vt REBUILD;

CREATE INDEX se_vt_blockgroupid ON TABLE se_vt(blockgroupid) AS
'org.apache.hadoop.hive.ql.index.compact.CompactIndexHandler' WITH DEFERRED
REBUILD;
ALTER INDEX se_vt_blockgroupid ON se_vt REBUILD;


Thanks and Regards,
Saky