Plan cache
See and clear the plans the planner keeps for each query shape.
See and clear the plans the planner keeps for each query shape. It helps when a plan chosen with old data no longer fits.
Requirements
- A user with
dbAdminon the database.
See the plans
JavaScript
db.orders.aggregate([{ $planCacheStats: {} }]);Clear the cache
JavaScript
db.orders.getPlanCache().clear();Check
After clearing it, $planCacheStats returns no plans until the collection receives new queries.
Common problems
- Plan cache index filters do not exist; to force an index use
hintin the query.