-
Type: Bug
-
Resolution: Done
-
Priority: Major - P3
-
None
-
Affects Version/s: 2.6.0-rc1
-
Component/s: Querying
-
None
-
ALL
In 2.6.0-rc1 I have an array "attr" which is indexed. Its contents are strings. In a query of type:
db.prod2.find({attr:{$all:["string1","string2","string3"]}})
The nscanned seems to be dependent on the order of values inside the $all list. Putting the more selective string first causes nscanned to be equal to number of documents with that string present.
Explain(true) shows only one index boundary is considered - the one that's listed first.
Note: this does not happen if the array elements are subdocuments and $elemMatch is used - then explain(true) shows that each of the elements in the $all list are tried and the one that's most selective is chosen regardless of the order they are given in.
- related to
-
SERVER-12281 When choosing multikey index bounds, never choose a superset if a subset is available
- Backlog