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

Reduce number of BSONObj allocations when building index bounds for $in

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 8.0.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None
    • Fully Compatible
    • QO 2024-02-05, QO 2024-02-19
    • 35

      As part of SERVER-85418, we found an inefficient allocation pattern when building the index bounds of a $in. For each entry in the $in operand, we call translateEquality to generate bounds to add to the OrderedIntervalList, which ends up calling objFromElement which allocates a new BSONObj to generate a collation aware index key (with an empty field name, which the Interval ignores). In the case of the default collation, this is unnecessary and we can create Intervals which point back to the BSON in the original BSON array representing the $in operand.

      The performance improvement from the proof of concept was 10%-50% increase in throughput on the LargeIndexedIn genny workload. This ticket represents the work necessary to productionize this PoC: fix the correctness issues it introduces when interval intersection was required and investigate the performance regressions in other workloads it introduced.

            Assignee:
            ben.shteinfeld@mongodb.com Ben Shteinfeld
            Reporter:
            ben.shteinfeld@mongodb.com Ben Shteinfeld
            Votes:
            0 Vote for this issue
            Watchers:
            14 Start watching this issue

              Created:
              Updated:
              Resolved: