Company
Date Published
Author
Chang Liu
Word count
2324
Language
English
Hacker News points
None

Summary

Index advisor is a feature introduced in Couchbase server 6.5, providing secondary index recommendation to help DBAs and developers optimize N1QL query performance. It follows design rules such as leading array index key for unnest, equality predicates, IN predicates, not less than/between/not greater than predicates, less than/greater than predicates, array predicates, derived join filter as leading key for left-hand-side keyspace, IS NOT NULL/MISSING/VALUED predicates, and functional predicates. Index advisor works in two ways: providing N1QL statement to advise indexes for a single query and advising on query workload and support session handling. It generates recommended indexes based on predicates in WHERE/ON clause, along with the corresponding recommendation rule that each index follows. The feature also supports covering indexes and array indexes for single keyspace queries, JOIN operations, ANY expressions, and UNNEST predicates. Index advisor uses a naming convention to generate unique and reasonable index names, ensuring they reflect the index construction and are different from user-defined indexes. Released as a developer preview feature, it is still in its initial stages and will be further enhanced to better meet customer requirements and contribute to query optimization.