[SERVER-81802] $lookup serializes unresolved sub-pipeline Created: 03/Oct/23  Updated: 31/Oct/23

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

Type: Improvement Priority: Major - P3
Reporter: Alyssa Clark Assignee: Backlog - Query Optimization
Resolution: Unresolved Votes: 0
Labels: query-product-scope-2, query-product-urgency-2, query-product-value-2
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to SERVER-81387 Problem re-parsing pipeline with view... Closed
Assigned Teams:
Query Optimization
Participants:

 Description   

When working on SERVER-81387, we noticed that $lookup explain returns the sub-pipeline with views unresolved. This is because it captures the original, user-specified pipeline in a _userPipeline field and always returns that. This behavior is inconsistent with other stages such as $unionWith, which return the fully resolved and optimized sub-pipeline for explain. We should consider making it more consistent (allowing for better introspection).

It appears that we do report optimizations made to the lookup stage in explain output by manually adding on absorbed unwind and match info.



 Comments   
Comment by David Storch [ 12/Oct/23 ]

There are some technical questions (including one of feasibility) because we think that the current implementation resolves views and optimizes the inner pipeline once per document from the outer side. Achieving this may require producing a dummy pipeline for the express purpose of displaying the results of view resolution and optimization. Sending to product triage cc christopher.harris@mongodb.com

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