[SERVER-70298] [CQF] Allow sorted merge of RIDs on interval level index union Created: 06/Oct/22  Updated: 29/Oct/23  Resolved: 10/Apr/23

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

Type: Improvement Priority: Major - P3
Reporter: Matt Boros Assignee: Matt Boros
Resolution: Fixed Votes: 0
Labels: optimization
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
depends on SERVER-70637 [CQF] Implement sorted merge physical... Closed
Assigned Teams:
Query Optimization
Backwards Compatibility: Fully Compatible
Sprint: QO 2022-10-31, QO 2022-11-14, QO 2022-11-28, QO 2022-12-12, QO 2022-12-26, QO 2023-01-09, QO 2023-01-23, QO 2023-03-20, QO 2023-04-03, QO 2023-04-17
Participants:

 Description   

Update IntervalLowerTransport to allow sorted merge of RIDs after an index union, instead of a GroupBy.

For example:

Unique []
|   projections: 
|       rid_0
GroupBy []
|   |   groupings: 
|   |       RefBlock: 
|   |           Variable [rid_0]
|   aggregations: 
Union []
|   |   |   BindBlock:
|   |   |       [rid_0]
|   |   |           Source []
|   |   IndexScan [{'<rid>': rid_0}, scanDefName: c1, indexDefName: index1, interval: {[Const [3], Const [3]]}]
|   |       BindBlock:
|   |           [rid_0]
|   |               Source []
|   IndexScan [{'<rid>': rid_0}, scanDefName: c1, indexDefName: index1, interval: {[Const [2], Const [2]]}]
|       BindBlock:
|           [rid_0]
|               Source []
IndexScan [{'<rid>': rid_0}, scanDefName: c1, indexDefName: index1, interval: {[Const [1], Const [1]]}]
    BindBlock:
        [rid_0]
            Source []

The RIDs into the groupby are going to be sorted, so sorted merge would be better

Instead of IndexScans -> Union -> GroupBy, we could have IndexScans -> SortedMerge -> Unique



 Comments   
Comment by Githook User [ 07/Apr/23 ]

Author:

{'name': 'Matt Boros', 'email': 'matt.boros@mongodb.com', 'username': 'mattBoros'}

Message: SERVER-70298 Allow sorted merge of RIDs on interval level index union
Branch: master
https://github.com/mongodb/mongo/commit/4a9de07fc5300c4891e53c973547aa8ec84d6314

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