[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: SERVER-55464 Optimize pipelines with $sort after $setWindowFields
Branch: master
https://github.com/mongodb/mongo/commit/01f296f4a6743195bbcf062014c139d96d6402ee

Generated at Thu Feb 08 05:36:33 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.