Company
Date Published
Author
Martin Esmann, Developer Advocate, Couchbase
Word count
2343
Language
English
Hacker News points
None

Summary

N1QL query language is introduced in Couchbase 4.0, bringing SQL-like queries to JSON documents. The performance of N1QL queries heavily depends on the shape of the data and the system used. Creating indexes can significantly improve performance. A test bench was created to measure the execution time of N1QL queries with and without indexes. The results showed that using secondary indexes can greatly improve query performance, with a factor of 100 to 1000 improvement in some cases. However, creating too many indexes can impact the cluster's CPU usage. Creating indexes is essential for optimal performance, and the code provided allows users to easily create indexes with a single line of code.