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

Avoid unnecessary BSON allocations in IndexScan getStats()

    XMLWordPrintableJSON

Details

    • Icon: Improvement Improvement
    • Resolution: Unresolved
    • Icon: Major - P3 Major - P3
    • None
    • None
    • None
    • None
    • Query Optimization

    Description

      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.

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated: