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

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

Note

For details on specific methods, including syntax and examples, click on the specific method to go to its 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.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中的新功能。