Buscar..
Estructura
CREATE INDEX index_name
ON TABLE base_table_name (col_name, ...)
AS 'index.handler.class.name'
[WITH DEFERRED REBUILD]
[IDXPROPERTIES (property_name=property_value, ...)]
[IN TABLE index_table_name]
[PARTITIONED BY (col_name, ...)]
[
[ ROW FORMAT ...] STORED AS ...
| STORED BY ...
]
[LOCATION hdfs_path]
[TBLPROPERTIES (...)]
Ejemplo:
CREATE INDEX inedx_salary ON TABLE employee(salary) AS 'org.apache.hadoop.hive.ql.index.compact.CompactIndexHandler' WITH DEFERRED REBUILD;
Alterar el índice
ALTER INDEX index_name ON nombre_tabla [PARTICIÓN (...)] RECONSTRUCCIÓN
Índice de caída
DROP INDEX <index_name> ON <table_name>
Si se especifica WITH DEFERRED REBUILD en CREATE INDEX, el índice creado recientemente estará inicialmente vacío (independientemente de si la tabla contiene algún dato).
El comando ALTER INDEX REBUILD se puede usar para construir la estructura del índice para todas las particiones o una sola partición.
Modified text is an extract of the original Stack Overflow Documentation
Licenciado bajo CC BY-SA 3.0
No afiliado a Stack Overflow