Extend SBE $lookup to handle custom pipelines containing a single $match stage

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Query Execution
    • QE 2025-05-26, QE 2025-06-09, QE 2025-06-23, QE 2025-07-07
    • None
    • 3
    • TBD
    • None
    • None
    • None
    • None
    • None
    • None
    • 0

      Currently SBE handles only $lookup stages where the join is performed as an equi-join between localField and foreignField path expressions. The optimizer can extend this syntax to include also a pipeline holding a $match to be performed on the foreign collection to trim its results during the scan.

      Improvement #1: convert the MatchExpression held by the $match stage into SBE code to be executed on top of the filtering done to enforce the equijoin constraint

      Improvement #2: if the $match expression is an $expr with a single $eq, or a top-level $and with at least one $eq children, pull up those equalities and add them to the equijoin constraints (including declaring any required variable defined in the let field of the $lookup)

            Assignee:
            Alberto Massari
            Reporter:
            Alberto Massari
            Votes:
            1 Vote for this issue
            Watchers:
            9 Start watching this issue

              Created:
              Updated: