Query analyzer doesn't use index specified by "use index" statement

Hi @icy44 ,

You are almost right. Index is uses skip list tree ( similar to b-tree ).

Also it is array Index. Each array element make separate entry in the index. (i.e. If u have one document and Array has 10 elements and 4 unique array keys, index will have 4 elements for this document)

Try see indexed data (run on indexer node)

/opt/couchbase/bin/cbindex -auth user:pass -type scanAll -bucket default -index ix1

Normally index keys must be based on predicates. If query has ORDER BY and query order by expressions matches with index keys order query can use index order and avoid sort. During that process planner will do some optimization. Example if query predicate has equality predicate and not present in query order by it can be assume as if present.

Also your index has ARRAY index with 2 elements checkout explanation here

1 Like