Create an index
This topic describes how to create an index by using SQL statements. It also describes the prerequisites, concepts, limitations, and recommendations for creating an index, and provides some examples.
This topic describes how to create an index by using the CREATE INDEX statement. Multi-value indexes can be created only when you create a table. For more information about other ways to create an index, see CREATE TABLE or ALTER TABLE.
Introduction
An index is also called a secondary index. It is an optional table structure. seekdb uses a clustered index table model. For the primary key specified by users, the system automatically generates a primary key index. For other indexes created by users, they are secondary indexes. You can decide based on your business needs which fields to create indexes on to speed up queries on those fields.
For more information about indexes in seekdb, see Introduction.
Prerequisites
Before you create an index, make sure that the following conditions are met:
-
You have deployed seekdb. For more information about how to deploy seekdb, see Overview.
-
You have connected to seekdb.
-
You have created a database. For more information about how to create a database, see Create a database.
-
You have created a table. For more information about how to create a table, see Create a table.
-
You have the
INDEXprivilege. For information about how to query the privileges of the current user, see Query the privileges of the current user. If you do not have the privilege, contact the administrator to grant the privilege. For information about how to directly grant a privilege, see Directly grant a privilege.