A newer version of this documentation is available.

View Latest

Indexes for N1QL

N1QL provides a SQL like query language for Couchbase. Unlike View Query API, N1QL does not require a dedicated index. You can use N1QL to issue ad-hoc queries on data.

Optimized N1QL Query execution is critical to the responsiveness of many applications. Indexes boost N1QL query performance. N1QL comes with indexes that provide different distribution topologies and storage options. N1QL indexes support both local and global index topologies, memory optimized storage options or different write modes for efficient IO performance of indexes. You can see a full summary of the options in the following figure. The next few sections cover all of the options shown in the figure below.

indexing options

Full administrators can use the Couchbase Web Console, CLI, or REST API to work with N1QL, Views and Global Secondary Indexes (GSI). Additionally, bucket users can access indexes on their buckets using N1QL REST API.

N1QL can only utilize views as an indexer when the index is created using the CREATE INDEX statement with the USING VIEW option.

Regardless of the GSI storage setting (standard GSI vs memory optimized GSI), it is still possible to create indexes using GSI or view during CREATE INDEX statement with the USING clause.