Make MergeSortStage advance faster by not returning NEED_TIME for each key

XMLWordPrintableJSON

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

      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:
            [DO NOT USE] Backlog - Query Optimization
            Reporter:
            David Storch
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated: