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

Process-global plan cache

    • Type: Icon: Improvement Improvement
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Querying
    • Labels:
      None
    • Query Execution

      The query system has a cache of plan information. This cache is used to skip the expensive plan generation and selection process when there are many instances of the query that have the same shape. The following documentation page has further information:

      https://docs.mongodb.com/manual/core/query-plans/

      The current architecture involves a per-collection plan cache. Whenever the user creates a new collection, it has a new plan cache inside of it. This means that, for users with many collections, the collective size of the resulting plan caches can use a prohibitively large amount of memory. In order to control the total amount of memory used for plan caching, we need a central component with knowledge of all the memory allocated for plan cache instances. The easiest way to achieve this would be to change the architecture so that there is a single plan cache per mongod instance. This could be done internally, without affecting the interface presented by $planCacheStats, or the older plan cache introspection commands.

      Note that this problem is compounded by SERVER-34886. A complete solution to the problem of plan cache memory consumption would likely require us to solve SERVER-34886 as well, by enforcing a maximum size of the global plan cache in bytes rather than enforcing a maximum number of entries.

            Assignee:
            backlog-query-execution [DO NOT USE] Backlog - Query Execution
            Reporter:
            david.storch@mongodb.com David Storch
            Votes:
            0 Vote for this issue
            Watchers:
            18 Start watching this issue

              Created:
              Updated: