These guides explain how to create and use primary and secondary indexes for SQL++ queries.
This page is for Couchbase Server.
You must create an index on a keyspace to be able to query that keyspace. The Index service enables you to create two types of index: primary indexes and secondary indexes.
To improve query responsiveness, you can choose where to save primary and secondary indexes. You can also partition a large secondary index across multiple nodes. In Couchbase Server Enterprise Edition, you can create replicas of primary indexes, secondary indexes, and secondary index partitions, to enhance index availability.
When you create a primary or secondary index, you can mark it as deferred. This means the index is not built at once; you can build the deferred index later. This enables you to build multiple indexes more efficiently.
Couchbase Server attempts to select an appropriate secondary index for a query, based on the filters in the WHERE clause. You can use an index hint to specify that a query should use a particular index.
You can drop primary and secondary indexes when you do not need them any more.
Refer to the following guide for information on the Index Advisor, and other optimization features.