• Type: Improvement
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Query Optimization
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      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
      classic multi-planner's trial_period::getTrialPeriodNumToReturn
      (src/mongo/db/exec/trial_period_utils.cpp), which takes {{min(findRequestLimit,
      internalQueryPlanEvaluationMaxResults)}}).

            Assignee:
            Unassigned
            Reporter:
            Naafiyan Ahmed
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: