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

Optimize $elemMatch in the Boolean expression simplifier

    • Type: Icon: Task Task
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None
    • Query Optimization

      1. $elemMatch children can be simplified as independent Boolean expressions, then the result could be attached to the parent's BitsetTree. We will need to modify `restoreMatchExpression` function to handle that case.
      2. In the $elemMatch's parent's conjunction contains the same terms as the $elemMatch's conjunction we can remove the terms from the $elemtMatch's conjunction. E.g.
         { "a": {"id":1}, "a":{$elemMatch:{"id":1, "b":9} } } == { "a": {"id":1}, "a":{$elemMatch:{"b":9} } } 

        see SERVER-22857

            Assignee:
            backlog-query-optimization [DO NOT USE] Backlog - Query Optimization
            Reporter:
            alexander.ignatyev@mongodb.com Alexander Ignatyev
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: