Use Primary and Secondary Indexes
These guides explain how to create and use primary and secondary indexes for SQL++ queries.
Create Indexes
You don’t need to create an index to query a keyspace. However, an index can help you to query a keyspace more efficiently. The Index service enables you to create two types of index: primary indexes and secondary indexes.
Place 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.
Defer Indexes
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.
Select Indexes
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.
Drop Indexes
You can drop primary and secondary indexes when you do not need them any more.
Get Index Advice
In Couchbase Server Enterprise Edition, the Index Advisor can analyze your queries and provide recommended indexes to optimize response times.