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

Aggregation should optimize an irrelevant $sort preceding a $group

    XMLWordPrintable

    Details

      Description

      At the moment, we execute the following pipeline:
      {$sort: {a: 1}} {$group: {_id: "$b"}}
      Despite the fact that the $sort has no effect upon the $group.

      We should change DocumentSourceSort::optimizeAt() to remove itself if the following stage is a $group that doesn't use any of the sort's keys.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              backlog-query-optimization Backlog - Query Optimization
              Reporter:
              benjamin.murphy Benjamin Murphy
              Participants:
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Dates

                Created:
                Updated: