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

Make MergeSortStage advance faster by not returning NEED_TIME for each key

    XMLWordPrintableJSON

Details

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

    Description

      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.

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated: