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

Terminate agg optimization after a maximum number of optimization steps

    XMLWordPrintableJSON

Details

    • Icon: Improvement Improvement
    • Resolution: Unresolved
    • Icon: Major - P3 Major - P3
    • None
    • None
    • None
    • Query Optimization

    Description

      When optimizing an aggregation pipeline, we may coalesce multiple stages, swap stages, split stages into two, or eliminate stages entirely. When such an optimization occurs, we often step backwards in order to see whether this optimization allows us to perform yet another optimization step that was not previously possible. Although we are confident that as currently implemented, this process will always terminate, it seems like it could be easy to introduce a code change in the future that would prevent termination in some cases.

      In order to make it trivial to prove that agg optimization always terminates, we should only be willing to perform at most some large maximum number of optimization steps. This would involve limiting the number of possible iterations here:

      https://github.com/mongodb/mongo/blob/r3.4.0-rc0/src/mongo/db/pipeline/pipeline.cpp#L113-L116

      Attachments

        Activity

          People

            backlog-query-optimization Backlog - Query Optimization
            david.storch@mongodb.com David Storch
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated: