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

Implement stage rewrite optimizations for $graphLookup

    XMLWordPrintableJSON

Details

    • Icon: Improvement Improvement
    • Resolution: Done
    • Icon: Major - P3 Major - P3
    • None
    • None
    • None
    • QO 2022-06-27, QO 2022-07-11

    Description

      $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

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: