-
Type: Improvement
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: Query Planning
-
None
-
Query Optimization
-
Fully Compatible
-
v8.0
-
200
In SERVER-70477 filters which will never match anything e.g., $in: [] are replaced with AlwaysFalseMatchExpression.
And in SERVER-81863, queries which generate a colscan and are always false, emit an EofNode.
However, queries which would otherwise generate an ixscan are not handled in this manner.
This resulted in BF-32974, as while the queries there would indeed never match anything, they still performed an index scan (satisfying a sort). The performance regression came from no longer being able to bound the scan based on other predicates if the whole filter was simplified down to AlwaysFalseMatchExpression, and instead fetched and filtered (with $alwaysFalse).
If it is known that the filter will not match anything, ever, the solution can be reduced to an EofNode, in the same manner as with colscans.
- is related to
-
SERVER-91241 Handle trivially false $match stages in agg pipelines
- Backlog