Enable match pushdown when predicates in the previous stage and the $match stage are independent but have the same name

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Query Optimization
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Currently, the `splitMatchExpressionBy` function will mark part of a match stage as ineligible for pushdown if the filter path and the paths required by the previous stage contain dependencies. For instance, in the following pipeline:

      [{$replaceWith: '$subDocument'},
       {$match: {'subDocument.x': 2}}

      the $match stage will not be pushed down because 'subDocument' and 'subDocument.x' are marked as dependent, even though the fields are independent in the document and simply have the same name:

      {subDocument: {subDocument: x}}

      We should improve the analysis of the `containsDependency` helper to recognize when a field is independent of and simply has the same/overlapping name as a field in an earlier stage.

              Assignee:
              Unassigned
              Reporter:
              Lynne Wang
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated: