[SERVER-19546] Prevent $project's from being sent to shard and merge pipes. Created: 23/Jul/15  Updated: 06/Dec/22

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

Type: Improvement Priority: Minor - P4
Reporter: James Cohan Assignee: Backlog - Query Optimization
Resolution: Unresolved Votes: 0
Labels: optimization
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
Assigned Teams:
Query Optimization
Sprint: Query 10 (02/22/16)
Participants:

 Description   

$project is sent to both the shard and merge pipes when it could be handled exclusively on the shard pipe.



 Comments   
Comment by Benjamin Murphy [ 23/Feb/16 ]

Unassigning and moving to backlog. Resolving this ticket is difficult until agg's dependency tracking is more thorough.

As initially proposed, a pipeline of the form:
DocSourceCursor with project (a: 1, b: 1) ----> (other stages) -----> $project (a: 1, b: 1)
Should have had the second $project removed, provided that (other stages) didn't include any stages with EXHAUSTIVE_FIELDS dependencies ($group or $project). Similarly, if the last $project on the shard pipe was identical to a project on the merge pipe, it seemed that the one on the merge pipe could be safely removed. However, due to $lookup/other stages, this is difficult:
DocSourceCursor (a:1, b:1) --> $lookup (results inserted into c) ---> $project (a:1, b:1)
In this case, the second project cannot be safely removed, because an additional field has been created due to $lookup, but we have no way of identifying that this has happened with our current dependency tracking.

Generated at Thu Feb 08 03:51:20 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.