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

Add no-op delimiter stage to aggregation to prevent pipeline optimizations

    • Type: Icon: Improvement Improvement
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Aggregation Framework
    • None
    • Query Optimization

      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.  

            Assignee:
            backlog-query-optimization [DO NOT USE] Backlog - Query Optimization
            Reporter:
            christopher.harris@mongodb.com Chris Harris
            Votes:
            1 Vote for this issue
            Watchers:
            11 Start watching this issue

              Created:
              Updated: