-
Type: Improvement
-
Resolution: Done
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: Aggregation Framework
-
None
-
Fully Compatible
If a limit follows a sort, then we can optimize the sort by only retaining the top-n items required to satisfy the request.
This may use one of http://www.cplusplus.com/reference/algorithm/partial_sort/ or
https://github.com/mongodb/mongo/blob/master/src/mongo/db/scanandorder.cpp#L40-85 , or if those don't fit, maintain a priority queue, and always discard elements after the top-n.
- is depended on by
-
SERVER-7781 geoNear aggregation pipeline stage
- Closed
- is related to
-
SERVER-447 new aggregation framework
- Closed