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

sort by shard key or prefix of shard key may not require merge before group

    XMLWordPrintable

    Details

    • Case:

      Description

      Consider the following scenario:

      Collection is sharded on field "symbol":

      db.coll.aggregate({$sort:{symbol:1, date:1}},{$group:{_id:"$symbol", first:{$first:"$start"},last:{$last:"$start"}, sum:{$sum:"$volume"}}})
      

      This pipeline will merge because of sort even though it does not need to.

      Related but not quite the same is SERVER-5477 which would allow the group to take place on the single shard in this example, but it wouldn't happen if $sort by shard key also wasn't correctly handled.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              backlog-query-optimization Backlog - Query Optimization
              Reporter:
              asya Asya Kamsky
              Participants:
              Votes:
              0 Vote for this issue
              Watchers:
              8 Start watching this issue

                Dates

                Created:
                Updated: