[SERVER-68102] Improve performance of SBE recursive index scan plans Created: 15/Jul/22  Updated: 29/Oct/23  Resolved: 24/Oct/22

Status: Closed
Project: Core Server
Component/s: Query Execution
Affects Version/s: None
Fix Version/s: 6.2.0-rc0

Type: Task Priority: Major - P3
Reporter: David Storch Assignee: Zixuan Zhuang
Resolution: Fixed Votes: 0
Labels: pm2697-m3
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Problem/Incident
Related
is related to SERVER-69751 Investigate SBE Linkbench regressions Closed
is related to SERVER-70054 [SBE] Investigate regression in Queri... Closed
Backwards Compatibility: Fully Compatible
Sprint: QE 2022-09-19, QE 2022-10-03, QE 2022-10-17, QE 2022-10-31
Participants:
Linked BF Score: 35
Story Points: 5

 Description   

We've seen some indications that the fully generic index scan algorithm implemented by the SBE stage builders can be slow. The stage builder produces plans using the CheckBoundsStage which look like this:

[1] nlj [] [s29, s24, s26]
                left
                    [1] sspool sp1 [s29, s24, s26]
                right
                    [1] chkbounds s25 s28 s31
                    [1] nlj [s24, s26] [s30]
                        left
                            [1] project [s24 = "a_1_b_1", s26 = {"a" : 1, "b" : 1}, s30 = s29]
                            [1] limit 1
                            [1] coscan
                        right
                            [1] ixseek s30 none s25 s28 s23 [] @"0552b0af-0102-434f-805e-32b741d99765" @"a_1_b_1" true

We should look into ways to make this faster. As a starting point, we could try an experiment where we implement a version of the sbe::IndexScanStage that operates directly over the IndexBounds. This stage would need to use the IndexBoundsChecker itself rather than relying on the "chkbounds" stage to do so. Then we can run a performance patch build and see how much this improves the numbers.



 Comments   
Comment by Githook User [ 24/Oct/22 ]

Author:

{'name': 'Zixuan Zhuang', 'email': 'zixuan.zhuang@mongodb.com', 'username': 'leozzx'}

Message: SERVER-68102 Improve Recursive IXScan for SBE
Branch: master
https://github.com/mongodb/mongo/commit/7a24f0a61f10f4f4cee4fd5be638c29c9ffdc02b

Comment by Zixuan Zhuang [ 26/Sep/22 ]

mihai.andrei@mongodb.com yes, but this test case has multiple indexes, multi-planner will probably choose a non-recursive plan. I'm trying to add another one that only has one index choice, but it's wired that I didn't see much op_per_sec difference for classic and existing sbe engine.

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