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

Make MergeSortStage advance faster by not returning NEED_TIME for each key

    • Type: Icon: Improvement Improvement
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 2.6.3
    • Component/s: Querying
    • Labels:
      None
    • Query Optimization

      Currently the merge sort implementation returns NEED_TIME every time that it retrieves a key from a child stage. See the code here:

      https://github.com/mongodb/mongo/blob/master/src/mongo/db/exec/merge_sort.cpp#L72-L125

      As a result, a merge sort plan is disadvantaged in plan ranking, as it could potentially advance more slowly than a plan with, say, a blocking sort stage. As an alternative, the MergeSortStage could retrieve multiple results from its children in one work() before returning NEED_TIME.

            Assignee:
            backlog-query-optimization [DO NOT USE] Backlog - Query Optimization
            Reporter:
            david.storch@mongodb.com David Storch
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated: