[SERVER-61702] Implement stage rewrite optimizations for $graphLookup Created: 22/Nov/21  Updated: 05/Jul/22  Resolved: 05/Jul/22

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Major - P3
Reporter: Matt Boros Assignee: Henri Nikku
Resolution: Done Votes: 0
Labels: neweng
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Sprint: QO 2022-06-27, QO 2022-07-11
Participants:

 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



 Comments   
Comment by Githook User [ 05/Jul/22 ]

Author:

{'name': 'Henri Nikku', 'email': 'henri.nikku@mongodb.com', 'username': 'henrinikku'}

Message: SERVER-61702 Implement stage rewrite optimizations for $graphLookup
Branch: master
https://github.com/mongodb/mongo/commit/71392af499bde03dae8d25b4407e204869dce5be

Generated at Thu Feb 08 05:53:06 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.