Skip to main content
This group of DDL SQL statements allows database administrators to manage indexes. Database administrators can create and drop indexes. You can view information about indexes using the sys.indexes system catalog table. For information on other database components, see the pages on Databases, Schemas, Tables, and Views.

CREATE INDEX

CREATE INDEX creates a new secondary index. Indexes help optimize database queries when created on columns that are frequently referenced. For more information on how indexes operate, see Secondary Indexes. Creating an index does not trigger re-indexing of existing segments. Only segments generated after the CREATE INDEX is issued contain the new index. Indexes can be created on columns containing various different data types as long as the requirements are met. Please note that depending on the data type, the system can assign different index types by default if you decline to specify which index type to use. The name must be distinct from the name of any existing index on the table.
You can apply indexes regardless of whether they have GDC compression.
Syntax
SQL

Index Types (<index_type>)

Ocient supports four index types alongside the clustering index: INVERTED, HASH, NGRAM, and SPATIAL. An index notionally stores a mapping of a column value to the rows that contain that value, and the index type differentiates the format in which the column values are stored and accessed. Unless an index type is explicitly specified with a USING clause, the data type of a column determines a default index type that the system creates. For information on index type defaults, see Index Type Requirements and Defaults. For container data types (e.g., arrays and tuples), the index stores the internal elements of the container, and is used on predicates that target the internal values. However, a mapping of NULL column values is generally stored for both scalar and container data types, so the index can always be used for column IS NULL predicates. For further description and examples of the index types, see Secondary Indexes. Examples This example creates an index named new_idx on the address column of the table. Because address is a VARCHAR column, this index defaults to the HASH index type.
SQL
This example creates an index of type NGRAM on the address column. As the NGRAM has no specified n_value, it defaults to indexing substrings of three characters long.
SQL
This example creates an index on a component of the tuple_col column. As this column is of data type INT, the index defaults to using the INVERTED type.
SQL
This example creates an index on a component of the point_col column. As this column is of data type POINT, the index defaults to using the SPATIAL type.
SQL

DROP INDEX

DROP INDEX drops a secondary index on a table. After an index is dropped, new segments that are generated do not contain the new index. However, no existing segments will be altered. This means that until a segment is rebuilt, you can still use the removed index internally, and the system does not reclaim the storage space the removed index occupied. Syntax
SQL
Example This example drops the index named new_idx on the employees table.
SQL
Core Elements of an Ocient System Data Query Language (DQL) Statement Reference Database Password Security Settings System Catalog
Last modified on July 8, 2026