Details
-
Improvement
-
Resolution: Fixed
-
Major - P3
-
None
-
None
-
None
-
Fully Compatible
-
QO 2023-10-16, QO 2023-10-30, QO 2023-11-13, QO 2023-11-27
-
56
Description
For the case that a find() has an $alwaysFalse: 1 condition (after Boolean optimization) the query should not be inspecting any documents at all. Instead the planner should generate a plan returning an empty set. The corresponding test is:
db.test.drop();
|
var explain = db.test.find({$alwaysFalse: 1}).explain("executionStats"); |
assert.eq(0, explain.executionStats.totalDocsExamined, explain); |
db.test.insert({a: 1}); |
var explain = db.test.find({$alwaysFalse: 1}).explain("executionStats"); |
assert.eq(0, explain.executionStats.totalDocsExamined, explain); |
Attachments
Issue Links
- is depended on by
-
SERVER-70477 Optimizing expressions that are tautologically constant (e.g., `True` or `False`)
-
- Closed
-
- is related to
-
SERVER-82397 User EOF plan for trivially false predicates when column store indexes
-
- Open
-
-
SERVER-82497 Optimize SBE EOF plans when in $lookup stages of pipelines
-
- Open
-