Aggregation should optimize an irrelevant $sort preceding a $group

XMLWordPrintableJSON

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

      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:
            [DO NOT USE] Backlog - Query Optimization
            Reporter:
            Benjamin Murphy (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated: