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

Aggregation should optimize an irrelevant $sort preceding a $group

    • Type: Icon: Improvement Improvement
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Aggregation Framework
    • Query Optimization

      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.

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

              Created:
              Updated: