Docs HomeMongoDB Manual

Query Plan Cache Methods查询计划缓存方法

The PlanCache methods are only accessible from a collection's plan cache object. PlanCache方法只能从集合的计划缓存对象访问。To retrieve the plan cache object, use the db.collection.getPlanCache() method.要检索计划缓存对象,请使用db.collection.getPlanCache()方法。

Note

For details on a specific method, including syntax and examples, click on the link to the method's reference page.有关特定方法的详细信息,包括语法和示例,请单击该方法参考页的链接。

Name名称Description描述
db.collection.getPlanCache()Returns an interface to access the query plan cache object and associated PlanCache methods for a collection.返回一个接口,用于访问集合的查询计划缓存对象和关联的PlanCache方法。
PlanCache.clear()Clears all the cached query plans for a collection. Accessible through the plan cache object of a specific collection, i.e. db.collection.getPlanCache().clear().清除集合的所有缓存查询计划。可通过特定集合的计划缓存对象访问,即db.collection.getPlanCache().clear()
PlanCache.clearPlansByQuery()Clears the cached query plans for the specified query shape. 清除指定查询形状的缓存查询计划。Accessible through the plan cache object of a specific collection, i.e. db.collection.getPlanCache().clearPlansByQuery()可通过特定集合的计划缓存对象访问,即db.collection.getPlanCache().clearPlansByQuery()
PlanCache.help()Displays the methods available for a collection's query plan cache. Accessible through the plan cache object of a specific collection, i.e. db.collection.getPlanCache().help().显示可用于集合的查询计划缓存的方法。可通过特定集合的计划缓存对象访问,即db.collection.getPlanCache().help()
PlanCache.list()Returns the plan cache information for a collection. Accessible through the plan cache object of a specific collection, i.e. db.collection.getPlanCache().list(). 返回集合的计划缓存信息。可通过特定集合的计划缓存对象访问,即db.collection.getPlanCache().list()
New in version 4.4. 4.4版新增。