Hi, all,i’ve found an issue with the index selection on cb.
The optimizer does not always choose and index if a partial match is found between the selection predicate and one index definition that can partially satisfy (only through the filter index definition) the where predicate when the where predicate consists only as an equality constraint on an expression matching the index filter condition.
steps to reproduce: giving a set of documents in a bucket, with this structure:
a:1,b:2, c:3, type:‘Triplet’
and an index definition like
create index choosemeplease on development (development.a) where development.type=‘Triplet’
issuing the following query:
select c.* from development c where c.type = ‘Triplet’ and c.a >= 0 i expect the optmizer to choose the index above.
the query plan generated show that a full bucket scan will be done.
however the optimizer choose the correct index if i change the query in:
select c.* from development c where c.type = ‘Triplet’ and c.a >= 0
in the latter case there is no issue.
I suspect that when a partial expression match is found the index filter condition is not fully take into account.