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

SubplanStage should not cache plan for an individual $or branch if plans tie or there are no query results

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: 3.1.2
    • Fix Version/s: 3.1.7
    • Component/s: Querying
    • Labels:
      None
    • Backwards Compatibility:
      Fully Compatible
    • Sprint:
      QuInt 8 08/28/15

      Description

      Versions 2.6.x and 3.0.x will not create a plan cache entry for a query shape if, during plan selection, either

      1. the winning plan ties with the runner-up, or
      2. the winning plan does not produce any results during the MultiPlanStage trial period.

      The intention behind this behavior is that in these edge cases the system has low confidence that it has selected the best plan. In order to avoid re-using the wrong plan from the cache for a subsequent execution of the query shape, the system refrains from creating a potentially erroneous cache entry.

      In version 3.1.2 under SERVER-15225, behavior was introduced to aggressively evict bad cache entries. This aggressive eviction obviated the need for not caching in case of ties or zero results, and therefore the system changed to always create a cache entry.

      However, due to a detail in the implementation of the SubplanStage, $or queries which use the subplan path do not benefit from SERVER-15225's plan cache eviction logic. This means that subplanned queries can experience a performance regression in which they choose the wrong plan in 3.1.x unstable releases greater than or equal to 3.1.2.

      We should correct this regression by re-introducing the "don't cache ties or zero result queries", just for queries that use the SubplanStage.

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: