SERVER-136925ClosedWon't Do

Bound the join plan cache trial window by the query's limit

The join plan cache measures its baseline (and, on a cache hit, runs its trial) over a fixed window of {{internalQueryJoinPlanCacheTrialWindow}} documents (default 101), independent of how many documents the query can actually return. When the query has a limit smaller than the window, the trial runs and buffers more than it needs. This increases the latency to first result in the case of limits. We should investigate using {{min(limit, internalQueryJoinPlanCacheTrialWindow)}} (mirroring the

Affected Versions
Versions known to exhibit this issue

No affected versions recorded.

Fixed Versions
Versions that include the fix

No fix available yet.

Components
Server components related to this issue

No components specified.

Labels
Tags and classification
M2join-limitjoin-plan-cache