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

Cache single solution plans in classic cache for queries using SBE

    • Type: Icon: Improvement Improvement
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Query Optimization

      In SERVER-90415 we are changing the system so that queries which run in SBE will use the classic plan cache by default. The SBE plan cache will only get used by queries executing in SBE when featureFlagSbeFull is on.

      In SERVER-13341 we will start to cache plans with a single QuerySolution in the classic cache for queries which run in classic.

      This ticket suggests combining these two improvements. That is, we should improve the code path where queries are running in SBE but using the classic cache to also create a classic cache entry when there is a single QuerySolution. This change was not incorporated into SERVER-13341 because SERVER-13341 and SERVER-90415 were developed independently and concurrently.

      We probably don't need to backport this improvement to 8.0. In 8.0, only queries involving $group/$lookup that tend to be longer running will execute in SBE. The longer overall query runtime largely masks the cost of plan preparation. This improvement would make plan preparation slightly cheaper by avoiding a call to QueryPlanner::plan(). However, this code path will still have to invoke the heavy-weight SBE stage builders, so the savings from skipping QueryPlanner::plan() may not be significant relative to the overall query runtime. Furthermore, this improvement might not be necessary at all if we never try to use the classic plan cache for short-running queries in SBE.

            Assignee:
            Unassigned Unassigned
            Reporter:
            david.storch@mongodb.com David Storch
            Votes:
            0 Vote for this issue
            Watchers:
            9 Start watching this issue

              Created:
              Updated: