Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-79013

Push top-level field extraction into 'scan' in Bonsai-generated SBE plans

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • ALL

      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.

            Assignee:
            richard.hausman@mongodb.com Richard Hausman (Inactive)
            Reporter:
            richard.hausman@mongodb.com Richard Hausman (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: