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

Include merge sort in sharded aggregation explain output

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Needs Scheduling
    • Priority: Major - P3
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      At some point before 4.2 we stopped including the merge sort in the explain output - I believe because the merge sort started happening within the $mergeCursors, which is not created nor displayed in explain output.

      We should somehow enhance the explain output to include the merge sort so that users don't mistakenly conclude that the merged output is not sorted.

       
      4.0:

      splitPipeline: {
        shardsPart: [
          {
            '$match': { mykey: { '$in': [ 0, 1, 3, 7 ] } }
          },
          { '$sort': { sortKey: { favColour: 1 }, limit: 5 } }
        ],
        mergerPart: [
          {
            '$sort': { sortKey: { favColour: 1 }, mergePresorted: true, limit: 5 }
          }
        ]
      }
      

      4.2/4.4:

       
      splitPipeline: {
        shardsPart: [
          {
            '$match': { mykey: { '$in': [ 0, 1, 3, 7 ] } }
          },
          { '$sort': { sortKey: { favColour: 1 }, limit: 5 } }
        ],
        mergerPart: [ { '$limit': 5 } ]
      }
      

       

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              backlog-query-optimization Backlog - Query Optimization
              Reporter:
              charlie.swanson Charlie Swanson
              Participants:
              Votes:
              2 Vote for this issue
              Watchers:
              10 Start watching this issue

                Dates

                Created:
                Updated: