This command is used to create secondary indexes in the CarbonData tables.
CREATE INDEX index_name
ON TABLE [db_name.]table_name (col_name1, col_name2)
AS 'carbondata'
PROPERTIES ('table_blocksize'='256');
Parameter |
Description |
---|---|
index_name |
Index table name. It consists of letters, digits, and special characters (_). |
db_name |
Database name. It consists of letters, digits, and special characters (_). |
table_name |
Name of the database table. It consists of letters, digits, and special characters (_). |
col_name |
Name of a column in a table. Multiple columns are supported. It consists of letters, digits, and special characters (_). |
table_blocksize |
Block size of a data file. For details, see •Block Size. |
db_name is optional.
create table productdb.productSalesTable(id int,price int,productName string,city string) stored as carbondata;
CREATE INDEX productNameIndexTable on table productdb.productSalesTable (productName,city) as 'carbondata' ;
In this example, a secondary table named productdb.productNameIndexTable is created and index information of the provided column is loaded.
A secondary index table will be created. Index information related to the provided column will be loaded into the secondary index table. The success message will be recorded in system logs.