[SERVER-55601] Improve performance of Queries.CoveredBlockingSort in SBE Created: 29/Mar/21 Updated: 29/Oct/23 Resolved: 21/May/21 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Query Execution |
| Affects Version/s: | None |
| Fix Version/s: | 5.0.0-rc0 |
| Type: | Improvement | Priority: | Major - P3 |
| Reporter: | Ian Boros | Assignee: | Nikita Lapkov (Inactive) |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | post-rc0, sbe-post-rc0 | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||
| Backwards Compatibility: | Fully Compatible | ||||||||||||||||
| Backport Requested: |
v5.0
|
||||||||||||||||
| Sprint: | Query Execution 2021-05-03, Query Execution 2021-05-17, Query Execution 2021-05-31 | ||||||||||||||||
| Participants: | |||||||||||||||||
| Description |
|
There are a few things we can do to improve the performance of this workload: 1) Eliminate the repeated allocations done in the CheckBoundsStage::getNext() here. We can instead hold a buffer in the stage and re-use that each call to toBson(). 2) Skip the allocation done in IndexBoundsBuilder::checkKey() (there's already a TODO about this) 3) WTIndexCursorBase::nextKeyString() makes a copy of the key string which requires allocating. We could instead keep a buffer up front in the IXscan stage and then pass a pointer to it. This would be a bit invasive, but it's worth trying to see how much benefit there is. |
| Comments |
| Comment by Githook User [ 24/May/21 ] | ||
|
Author: {'name': 'Nikita Lapkov', 'email': 'nikita.lapkov@mongodb.com', 'username': 'laplab'}Message: (cherry picked from commit c35c11a7aa7fd7c585268d05204cdb00efbb1852) | ||
| Comment by Githook User [ 21/May/21 ] | ||
|
Author: {'name': 'Nikita Lapkov', 'email': 'nikita.lapkov@mongodb.com', 'username': 'laplab'}Message: | ||
| Comment by Anton Korshunov [ 30/Mar/21 ] | ||
|
Some more ideas to consider are in SERVER-48634 and SERVER-48485. | ||
| Comment by Ian Boros [ 29/Mar/21 ] | ||
|
In the future we'll also want to eliminate calls to getField() when generating the sort key. See here. Currently we generate plans like:
This call to getField() is just wasted work since "y" is already in s3 and there's no need to walk serialized BSON looking for it. This would probably have to be done as some sort of broader "tracking" mechanism which I believe is already in the works by the folks working on the AST. |