-
Type: Improvement
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: None
-
None
-
Fully Compatible
-
QO 2023-10-16, QO 2023-10-30, QO 2023-11-13, QO 2023-11-27
-
56
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);
- 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
- Closed
- related to
-
SERVER-33925 Queries that are known to return no results at plan time should optimize to EOF plan
- Backlog