[SERVER-83122] Optimize field projection in limit-sort pipeline in sbe Created: 10/Nov/23 Updated: 21/Dec/23 Resolved: 07/Dec/23 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | 7.3.0-rc0 |
| Type: | Task | Priority: | Major - P3 |
| Reporter: | Projjal Chanda | Assignee: | Foteini Alvanaki |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||
| Backwards Compatibility: | Fully Compatible | ||||
| Sprint: | QE 2023-11-13, QE 2023-11-27, QE 2023-12-11 | ||||
| Participants: | |||||
| Linked BF Score: | 35 | ||||
| Description |
|
With recent change |
| Comments |
| Comment by Githook User [ 07/Dec/23 ] |
|
Author: {'name': 'Foteini Alvanaki', 'email': 'foteini.alvanaki@mongodb.com', 'username': ''}Message: GitOrigin-RevId: 68358060ebc028af5c8b51cb1e26b0c74e0458f0 |
| Comment by Projjal Chanda [ 27/Nov/23 ] |
|
There is regression in sbe in workloads where the window stage is followed by a (small) $limit, and preceded by a sort stage. The sort stage desugared from $setWindowFields executes in sbe. When the window stage is in sbe, it pushes down its required fields through the sort stage in addition to result object, while when the window stage is in classic the sort stage in sbe only holds result object. So in fullsbe, there is higher allocations and cache pressure in the sort stage with these extra fields, resulting in slower sort. This is not an issue generally since the following stages will benefit from direct access to the required fields. But when we have a $limit (with a small limit) after the window stage, the sort stage still has to sort all the documents in the collection. So the sort stage completely dominates the execution time and the slower sort in case of fullSbe makes the overall query slower. |