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

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 5.0.0-rc0
    • Component/s: Query Planning
    • Labels:
      None
    • Backwards Compatibility:
      Fully Compatible
    • Sprint:
      Query Execution 2021-05-03, Query Execution 2021-05-17

      Description

      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.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              ian.boros Ian Boros
              Reporter:
              anton.korshunov Anton Korshunov
              Participants:
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: