Creating an Index
Use the SQL command CREATE INDEX to create a secondary index for a table in the data grid.
- Procedure
- Compose a string with the following format:
CREATE INDEX [ IF NOT EXISTS ] <index_name> ON <table_name> ( <column_name> [, <column_name>]...) [ <property_name>=<property_value> [, <property_name>=<property_value>]... ]
- Pass the string to the
ExecuteUpdate
method of thetibdgSession
object.For example:
CREATE INDEX index1 ON table1 (col1, col5) CREATE INDEX IF NOT EXISTS index2 ON table1 (col1, col5, col7) CREATE INDEX index3 ON table1 (col2, col3) row_counts=exact
Note the following points when using the CREATE INDEX command:
- Only columns with data types which map to ActiveSpaces long and string data types can be secondary index columns. For more information, see SQL Data Type Mapping.
- Escaped names are supported.
Note: In SQL, an escaped name is a sequence of one or more characters enclosed within SQL escape characters. Trailing spaces are insignificant.
Special characters used within the escaped name must themselves be escaped.
- Object names (for example <column_name>, <index_name>, and <table_name>) are case insensitive.
- ActiveSpaces converts all object names to lowercase before executing the command.