-
Type: Bug
-
Resolution: Duplicate
-
Priority: Major - P3
-
None
-
Affects Version/s: 5.0.14, 6.0.3, 6.2.0-rc5
-
Component/s: None
-
None
-
Query Optimization
-
ALL
-
v6.0, v5.0, v4.4, v4.2
-
-
QO 2023-02-06, QO 2023-02-20
When computing the plan cache key for a query of the shape {a: {$gt: <>, $lt: <>}}, we look at each individual clause and compute the discriminator for that predicate only. If an index contains a partial filter expression that is able to satisfy the entire query but not each individual predicate, then the discriminator incorrectly indicates that the index is not compatible. (The $gt and $lt are not particularly relevant, just easier to demonstrate the issue)
The impact of this is that two queries may be considered equivalent from the plan cache perspective, and thus an ineligible plan (incorrect results) gets chosen for a query which is actually not compatible with the partial index. Note that the core planner logic for determining index compatibility is separate from the plan cache key computation.
- duplicates
-
SERVER-68434 Equality to null can incorrectly use a cached partial ixscan which does not cover the predicate
- Closed