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

Productivity formula in SBE plan ranker should include the number of index seeks, along with index reads

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 5.0.0-rc0
    • Affects Version/s: None
    • Component/s: Query Planning
    • None
    • Fully Compatible
    • Query Execution 2021-05-03, Query Execution 2021-05-17

      At present the productivity formula in the SBE plan scorer is based on the 'numReads' metric. In case of an index scan, the 'numReads' would only get incremented when an index key has been located and fetched. This aligns with how the 'keysExamined' metrics is computed in the classic engine. However, in SBE we can construct a complex sub-tree implementing a generic index scan for multi-interval bounds, which may perform a lot of index 'seeks' which would be counted in the 'numReads', if the returned key is not within the bounds of the current interval and we need to restart the search from a new seek key.

      This would mean that we may do a lot of work which wouldn't be reflected in the productivity formula, an we potentially may pick a bad plan.

      To address this issue we may want to consider collecting two metrics:

      • numReads: the number of keysExamined + the number of seeks
      • keysExamined: the name says it all

      We would use 'numReads' for plan ranking and 'keysExamined' for reporting the summary stats.

            Assignee:
            ian.boros@mongodb.com Ian Boros
            Reporter:
            anton.korshunov@mongodb.com Anton Korshunov
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: