Details
-
Improvement
-
Resolution: Done
-
Major - P3
-
None
-
None
-
Fully Compatible
Description
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.
Attachments
Issue Links
- is depended on by
-
SERVER-7781 geoNear aggregation pipeline stage
-
- Closed
-
- is related to
-
SERVER-447 new aggregation framework
-
- Closed
-