-
Type:
Improvement
-
Resolution: Unresolved
-
Priority:
Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
Query Optimization
-
None
-
3
-
TBD
-
None
-
None
-
None
-
None
-
None
-
None
-
None
For some reason, if there are multiple plans that share the same cost, picking the first one does not guarantee that the same plan will be picked every time the same query is run. This is a problem for golden_tests where any plan flips will cause BFs.
There are multiple uses of `unordered_map` in the plan enumerator, so I guess it is the input to CBR that is randomized.
If a simple solution that does not involve full tie-breaking is implemented, that would be much appreciated.
There are two cases where this currently happens:
- if there are two indexes that cover the same field and a predicate on said field, either index may be chosen because they all have the same costs regardless of index scan direction or whether the index is compound or not
- if there is an `OR` in the plan, the plan enumerator may generate two plans that each have the inputs to `OR` in different order. Those two plans will have the same cost and therefore either one can be chosen.
- is related to
-
SERVER-106983 Investigate instability in plan selection for certain queries
-
- In Progress
-
-
SERVER-97933 Resolve cost ties in a deterministic way
-
- Needs Scheduling
-
- related to
-
SERVER-98102 Take account the number of fields in the index when calculating the cost
-
- Needs Scheduling
-