[SERVER-77601] Support sort keys in clustered collection scans in SBE Created: 30/May/23  Updated: 14/Jun/23

Status: Backlog
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Major - P3
Reporter: Gil Alon Assignee: Backlog - Query Execution
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to SERVER-77280 $or queries only produce collscan for... Closed
Assigned Teams:
Query Execution
Participants:

 Description   

SERVER-77280 allowed for the OR stage to have clustered collection scans as its children, and will unblock the bug described in SERVER-61259. However, the query below for a clustered collection fails: 

coll.find({ $or: [{ _id: { $lt: 1 } }, { _id: { $gt: 8 } }] }).sort({_id:1});

The generated plan is MERGE_SORT with 2 CLUSTERED_IXSCAN children. In SBE this tassert is hit, but this generated plan works in classic. Therefore, SBE should support these plans and support sort keys when building clustered collection scans.



 Comments   
Comment by Gil Alon [ 06/Jun/23 ]

kevin.cherkauer@mongodb.com my mistake. The link you sent is what I meant, and I just updated the ticket description.

Comment by Kevin Cherkauer [ 06/Jun/23 ]

ana.meza@mongodb.com This is not related to my project PM-3161 Support clustered collections in SBE, but to SERVER-77280 as Gil said in the description, since the latter is what first made it possible for there to be more than one collection scan stage in a plan. (CLUSTERED_IXSCAN is a clustered collection scan.)

gil.alon@mongodb.com Note the code you highlighted with the "tassert" link above isn't actually a tassert – it is a comment in a method that has no tasserts in it, so it must be the wrong link. Maybe you meant this line?

https://github.com/10gen/mongo/blob/778634272e0854591bd6b17dc1fae653b7916562/src/mongo/db/query/sbe_stage_builder.cpp#L464

Comment by Ana Meza [ 06/Jun/23 ]

kevin.cherkauer@mongodb.com wondering if this is related to your project.

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