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

[CQF] Decide how to deal with creating a global SBE slot for ShardFilterer

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 7.1.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None
    • Query Optimization
    • Fully Compatible
    • QO 2023-09-04

      There are a couple of scenarios in which the necessity of creating an SBE slot depends on the characteristics of an SBE plan (for example, $now and shardFilter). This ticket will focus on shardFilter, but it remains a question for other scenarios.

      There are a couple of proposed solutions on how best to handle this scenario:

      1. (Currently used for shardFilterer) Globally allocate and fill a slot before running ABT lowering, such as in cqf_get_executor.cpp. These slots may not end up being used, but the solution is simple and unlikely to cause issues/bugs in the future. Note (idea from Nick): we could also allocate these slots in the constructor of RuntimeEnvironment.
      2. Make RuntimeEnvironment non-const and create the slots as-needed from within the lowering (or other) code, when it becomes clear that the slot is needed. This is nice because it creates the slot if it's needed and makes intuitive sense, but in some scenarios the need for it might be optimized out, and it requires making RuntimeEnvironment non-const.
      3. Prior to execution of the SBE plan, perform a "second-pass" walk in which we analyze the plan, see if a shard filterer is called for, and create the slot if so. This is nice because everything happens in one place and the slot is created if and only if needed, but it requires a second round of walking which could have performance implications.

       

      The task of this ticket is to decide what the best solution is and implement it for shard filtering, then to file a ticket to make the improvement in the other analogous cases.

            Assignee:
            ben.shteinfeld@mongodb.com Ben Shteinfeld
            Reporter:
            richard.hausman@mongodb.com Richard Hausman (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved: