[SERVER-70477] Optimizing expressions that are tautologically constant (e.g., `True` or `False`) Created: 11/Oct/22  Updated: 24/Nov/23  Resolved: 16/Nov/23

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 7.3.0-rc0

Type: Improvement Priority: Major - P3
Reporter: Mohammad Dashti (Inactive) Assignee: Carlos Alonso Pérez
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
depends on SERVER-81863 Avoid a scan of either IDX or a colle... Closed
Problem/Incident
Assigned Teams:
Query Optimization
Backwards Compatibility: Fully Compatible
Sprint: QO 2023-10-16, QO 2023-10-30, QO 2023-11-13, QO 2023-11-27
Participants:
Linked BF Score: 120

 Description   

Irina suggested in this comment that {$in: []} is tautologically "false" so it would be nice to optimize the plan to "return an empty result right away" rather than scanning anything.



 Comments   
Comment by Githook User [ 16/Nov/23 ]

Author:

{'name': 'Carlos Alonso', 'email': 'c.alonso@mongodb.com', 'username': 'calonso'}

Message: SERVER-70477 Rewrite empty in predicate as alwaysFalse
Branch: master
https://github.com/mongodb/mongo/commit/b574e4aa52e04ad49c26fd2f02205768e5b43ba0

Generated at Thu Feb 08 06:16:16 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.