-
Type: Bug
-
Resolution: Duplicate
-
Priority: Major - P3
-
None
-
Affects Version/s: 3.0.3
-
Component/s: Querying
-
None
-
QuInt B (11/02/15)
With a collection that has two indexes like:
1) a_1_b_1_c_1
2) c_1_b_1_a_1
If you run a query like: {a: { "$in": [1]}, b:1, c: { "$in": [1,2,3]}}).sort({c:1}), a query shape will be cached with the associated plans that do no require sort and it is likely that the plan using the a_1_b_1_c_1 will get the top score.
If you now run query like: {a: { "$in": [1,2,3]}, b:1, c: { "$in": [1,2,3]}}).sort({c:1}), the cached plan with top score will be used. As the query requires SORT stage, the plan will be re-adjusted, however if at the sort stage we hit the 32Mb limit, the query will fail despite the fact that there is an alternative plan cached that uses the c_1_b_1_a_1 index, which if used, will require no sort and re-adjustment.
- duplicates
-
SERVER-15225 CachedPlanStage should execute for trial period and re-plan if query performs poorly
- Closed
- is related to
-
SERVER-21065 Optimizer should consider predicate with "$in" operator having a single argument to be equivalent to the equality operator
- Closed