Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-34759

Improve the planner to detect {$alwaysTrue: 1} to mean the same thing as {$and: []} and {}.

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 7.1.0-rc0
    • Affects Version/s: None
    • Component/s: Querying
    • Query Optimization
    • Fully Compatible
    • QO 2023-05-01

      As part of an enhancement to the optimization explored in SERVER-34714 it was discovered that replacing the empty query with {$alwaysTrue: 1} resulted in some planning regressions.

       

      Conclusion of the discussion is that the $AlwaysTrue and $and[] should be "normalized" for all cases to {} as this is more robust in the optimizer (default case having no predicated at all). 

            Assignee:
            peter.volk@mongodb.com Peter Volk
            Reporter:
            charlie.swanson@mongodb.com Charlie Swanson
            Votes:
            0 Vote for this issue
            Watchers:
            9 Start watching this issue

              Created:
              Updated:
              Resolved: