[SERVER-22966] Aggregation should use the output of DocumentSource::getOutputSorts() to optimize wherever possible. Created: 04/Mar/16 Updated: 06/Dec/22 |
|
| Status: | Backlog |
| Project: | Core Server |
| Component/s: | Aggregation Framework |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Major - P3 |
| Reporter: | Benjamin Murphy | Assignee: | Backlog - Query Optimization |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | eng-s | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Assigned Teams: |
Query Optimization
|
| Participants: |
| Description |
|
As part of SERVER-4507, a virtual method was introduced on DocumentSource, getOutputSorts, that allows the following stage to determine what, if any, sorting is present on the stream of input documents. At the moment, only $group takes advantage of this knowledge. Where possible, other stages should be expanded to take advantage of it as well. Of course, the primary example is $sort, which can do far less work if the input is already sorted by the sort key, but other possibilities may exist as well. |