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

Avoid unnecessary BSON allocations in IndexScan getStats()

    • Type: Icon: Improvement Improvement
    • Resolution: Won't Do
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Query Optimization

      As part of SERVER-85418, we found that there are many allocations as part of pickBestPlan, which ends up calling getStats() on the PlanStage root. The purpose of this is to get the statistics and produce the score of the plan tree in order to invoke the plan ranker.

      The classic IndexScan execution stage invokes toBSON on the bounds as part of getStats(), but as part as I can tell, this is only necessary for explain and is not necessary for calculating the plan's score. In the LargeIndexedIn genny workload, this contributes to a large number (90%+) of allocations in the workload. If we confirm that this field is only used in the explain path, we should avoid doing this work as part of the regular multi-planning codepath. I suspect this will have a positive performance benefit.

            Assignee:
            hana.pearlman@mongodb.com Hana Pearlman
            Reporter:
            ben.shteinfeld@mongodb.com Ben Shteinfeld
            Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved: