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

Aggregation should optimize an irrelevant $sort preceding a $group

    XMLWordPrintableJSON

Details

    • Icon: Improvement Improvement
    • Resolution: Unresolved
    • Icon: Major - P3 Major - P3
    • None
    • None
    • Aggregation Framework
    • Query Optimization

    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

        Activity

          People

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

            Dates

              Created:
              Updated: