[SERVER-79012] Push top-level field extraction into 'scan' in Bonsai-generated SBE plans Created: 17/Jul/23  Updated: 27/Jul/23  Resolved: 27/Jul/23

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

Type: Task Priority: Major - P3
Reporter: Richard Hausman (Inactive) Assignee: Backlog - Query Optimization
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
duplicates SERVER-78507 [CQF] Satisfy RemoveOrphansRequiremen... Closed
Related
related to SERVER-79403 Avoid implementing stacks of Evaluati... Closed
Assigned Teams:
Query Optimization
Participants:

 Description   

The extraction of multiple top level fields can be represented in an SBE plan either as a series of getField() calls, or as a single scan over several slots.

Here is an example of the former (outputted by Bonsai):

[5] filter {shardFilter(s5, makeBsonObj(MakeObjSpec(drop, [], ["a", "b", "c"]), Nothing, s2, s3, s4))} 
[4] project [s4 = getField(s1, "c")] 
[3] project [s3 = getField(s1, "b")] 
[2] project [s2 = getField(s1, "a")] 
[1] scan s1 none none none none none none none lowPriority [] @"<collUUID>" true false  

And of the latter (outputted by Stage Builders):

filter {shardFilter(s5, makeBsonObj(MakeObjSpec(drop, [], ["a", "b", "c"]), Nothing, s2, s3, s4))} 
scan [s2 = a, s3 = b, s4 = c] 

The latter is far more efficient, and should be the behavior of Bonsai-generated plans as part of CQF.


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