[SERVER-55464] Optimize pipelines with $sort after $setWindowFields where possible Created: 23/Mar/21 Updated: 29/Oct/23 Resolved: 17/May/21 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | 5.0.0-rc0 |
| Type: | Improvement | Priority: | Major - P3 |
| Reporter: | Nicholas Zolnierz | Assignee: | David Percy |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Backwards Compatibility: | Fully Compatible |
| Sprint: | Query Optimization 2021-04-05, Query Optimization 2021-04-19, Query Optimization 2021-05-03, Query Optimization 2021-05-17 |
| Participants: |
| Description |
|
Semantically, the $setWindowFields stage does not guarantee an output order so users may add a $sort stage to get the order they want. Since the physical implementation for $setWindowFields happens to have a guaranteed order, we should drop (or coalesce or swap) the user $sort if its not necessary. |
| Comments |
| Comment by Githook User [ 17/May/21 ] |
|
Author: {'name': 'David Percy', 'email': 'david.percy@mongodb.com', 'username': 'dpercy'}Message: |