SERVER-98371ClosedFixed

Reduce allocations when estimating number of index keys of a scan using sampling

In SERVER-98115, we implemented an initial approach to sampling estimation of number of index keys of an IndexScan. It works by invoking the BTreeKeyGenerator on each document to generate the set of index keys expressed as key strings, converting each key string to BSON, and then evaluating how many keys fall in the given IndexBounds. We can improve the performance by avoiding unnecessary allocations of key string and BSON index keys. We can use [BSONElementIterator|https://github.com/10gen/m

Affected Versions
Versions known to exhibit this issue

No affected versions recorded.

Fixed Versions
Versions that include the fix
8.3.0-rc0
Components
Server components related to this issue

No components specified.

Labels
Tags and classification
auto-revertedcbr_ce_sources