-
Type:
Improvement
-
Resolution: Unresolved
-
Priority:
Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
Query Optimization
-
None
-
None
-
None
-
None
-
None
-
None
-
None
When a partial filter expression uses $in we sometimes don't recognize that it can satisfy a query using $in. For example:
> db.foo.createIndex({a: 1, b: 1}, {partialFilterExpression: {b: {$in: [1, 2, 3]}}})
> db.foo.explain().aggregate({$match: {a: 1, b: {$in: [1, 2]}}})
{
…
“winningPlan" : {
"stage" : "COLLSCAN”,
…
}
This query should be eligible to use this index.
The problem is in our expression_algo::isSubsetOf() logic for $in partial filter expressions here. In particular, the loop over the elements of the RHS in-list is overly conservative. Instead, we should check if one in-list is a subset of another.
This issue is similar to SERVER-73792 but proposes to target this singular, specific improvement.
- is related to
-
SERVER-73792 Partial index isSubsetOf could be more precise for $or / $in
-
- Open
-