[SERVER-85588] Reduce number of BSONObj allocations when building index bounds for $in Created: 23/Jan/24  Updated: 02/Feb/24

Status: Investigating
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Major - P3
Reporter: Ben Shteinfeld Assignee: Ben Shteinfeld
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to SERVER-85418 Investigate large_indexed_ins ineffic... Closed
Sprint: QO 2024-02-05, QO 2024-02-19
Participants:

 Description   

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.


Generated at Thu Feb 08 06:58:07 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.