-
Type: Improvement
-
Resolution: Duplicate
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: Querying
-
None
-
Minor Change
In version 2.4 and before, predicate order was significant to the query optimizer. Thus if selectivity of a query predicate was known, it could influence the planner.
Now, query plans are normalized into a generic query execution tree and re-ordered, so predicate evaluation order can be "surprising" based on the sort order of the actual data being queried for. There is no way to override this behavior because in both cases, the optimizer chooses the correct "plan" but can't choose the correct predicate to evaluate first.
Attaching a test which if run in 2.4 and then 2.5.5 shows the change in behavior. One example uses a hash_merge of 3 $and predicates on a single multi-key index, one with a very low cardinality.
The second example shows a 2 predicate $and query where the optimizer chooses the wrong query predicate.
- duplicates
-
SERVER-16042 Optimise $all/$and to select smallest subset as initial index bounds
- Closed
- is duplicated by
-
SERVER-12865 MultiKey Cardinality issues in index intersection
- Closed