[SERVER-38585] Add no-op delimiter stage to aggregation to prevent pipeline optimizations Created: 12/Dec/18  Updated: 26/Jan/23

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

Type: Improvement Priority: Major - P3
Reporter: Chris Harris Assignee: Backlog - Query Optimization
Resolution: Unresolved Votes: 1
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
is duplicated by SERVER-42197 Expose a per-query flag to disable ag... Closed
Related
related to SERVER-42197 Expose a per-query flag to disable ag... Closed
Assigned Teams:
Query Optimization
Participants:

 Description   

MongoDB will perform a variety of sequencing and coalescing optimizations to an aggregation pipeline.  These are very helpful and the list of available modifications continues to grow over time.

However in some situations these modifications have a negative impact on performance.  In such cases, it would be beneficial to have additional control over how the pipeline is split.

As an arbitrary example, consider that there is a workaround in SERVER-7568 that involves injecting a $project between a $match and $sort to modify the indices eligible for use by the operation.  Notably SERVER-26442 is a request to introduce an additional optimization that would "break" this workaround.  For that reason, workaround such as that are not something that we would guarantee to behave the same across versions.  

Introducing a dedicated stage such as  {$hint: {delimitPipeline: true}} would provide additional control if needed in specific situations.  



 Comments   
Comment by Asya Kamsky [ 17/Dec/18 ]

Interesting idea.  If we had some sort of $tee it could serve a similar purpose (indicating that documents are needed to examine as they are at this point in the pipeline).  Then the actual output of the documents could be optional. 

 

Generated at Thu Feb 08 04:49:22 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.