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

Implement stage rewrite optimizations for $graphLookup

    • Type: Icon: Improvement Improvement
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • QO 2022-06-27, QO 2022-07-11

      $graphLookup does not implement many optimizations. We can look at the optimizations for $lookup to see what rewrites can occur since $lookup and $graphLookup have similar behavior. Examples of rewrites that could work are:

      • If we have an internal $unwind that has preserveNullAndEmpty equal to true, it can swap with $limit
      • If there is no internal unwind, $graphLookup can swap with skip and limit.
      • If we have $graphLookup followed by $sort, and $sort does not use any fields created by $graphLookup, they can swap.

      There are likely other optimizations in $lookup that can apply to $graphLookup

            Assignee:
            henri.nikku@mongodb.com Henri Nikku
            Reporter:
            matt.boros@mongodb.com Matt Boros
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: