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

Process-global plan cache



    • Improvement
    • Status: Backlog
    • Major - P3
    • Resolution: Unresolved
    • None
    • None
    • Querying
    • None


      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:


      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.


        Issue Links



              backlog-query-execution Backlog - Query Execution
              david.storch@mongodb.com David Storch
              0 Vote for this issue
              16 Start watching this issue