[SERVER-78047] Push $limit stage into $sort pushdown for time-series collection Created: 13/Jun/23  Updated: 29/Oct/23  Resolved: 11/Jul/23

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 7.1.0-rc0

Type: Improvement Priority: Major - P3
Reporter: Alice Li (Inactive) Assignee: Alice Li (Inactive)
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Issue split
split from SERVER-77276 Push $limit stage into the PlanStage ... Closed
Backwards Compatibility: Fully Compatible
Participants:

 Description   

Add time-series query rewrite to push $limit into $sort (for sort on the metadata field) so that we don't sort buckets that are not necessary

It is safe to assume that every bucket has at least one measurement. We should rewrite [\{$_unpack}, \{$sort}, \{$limit: x}] pipeline as [\{$sort(with limit)}, \{$_unpack}, \{$limit: x}]



 Comments   
Comment by Githook User [ 05/Jul/23 ]

Author:

{'name': 'Alice Li', 'email': 'alice.li@mongodb.com', 'username': ''}

Message: SERVER-78047 Push $limit up into $sort for time-series collection
Branch: master
https://github.com/mongodb/mongo/commit/3b29c47e90d2c0f3546ac391b5c05b6244f5549a

Generated at Thu Feb 08 06:37:19 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.