ExportXMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Unresolved
    • Priority: Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Query Optimization
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Now that we allow $projections (and soon renames) in subpipelines, we should allow queries like this to participate in join optimization:

       

      {$lookup: {from: "A", let: {lf: "$a"}, as: "fromA", pipeline: [
         {$project: {renamedField: "$b"}},
         {$match: {$expr: {$eq: ["$$lf", "$b"]}}}
      ]}},
      {$unwind: "$fromA"}

      It shouldn't matter if the $match is at the start or end of the pipeline, since we will keep the $project in our CQ & encode the edge into the join graph (i.e. once this goes to SBE, the edge is "executed" after the $project even if you swap the $match/$project, and this is correct regardless).

       

            Assignee:
            Unassigned
            Reporter:
            Alya Berciu
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: