SQL Server Plan Cache 对象SQL Server, Plan Cache Object

适用对象:是SQL Server 否Azure SQL 数据库 否Azure Synapse Analytics (SQL DW) 否并行数据仓库APPLIES TO: yesSQL Server noAzure SQL Database noAzure Synapse Analytics (SQL DW) noParallel Data Warehouse

Plan Cache 对象提供用于监视 SQL ServerSQL Server 如何使用内存来存储对象(例如存储过程、即席和准备的 Transact-SQLTransact-SQL 语句以及触发器)的计数器。The Plan Cache object provides counters to monitor how SQL ServerSQL Server uses memory to store objects such as stored procedures, ad hoc and prepared Transact-SQLTransact-SQL statements, and triggers. 可同时监视 Plan Cache 对象的多个实例,每个实例代表一个要监视的不同类型的计划。Multiple instances of the Plan Cache object can be monitored at the same time, with each instance representing a different type of plan to monitor.

下表介绍了 SQLServer:Plan Cache计数器。This table describes are the SQLServer:Plan Cachecounters.

SQL Server Plan Cache 计数器SQL Server Plan Cache counters 描述Description
Cache Hit RatioCache Hit Ratio 高速缓存命中次数和查找次数的比率。Ratio between cache hits and lookups.
Cache Hit Ratio BaseCache Hit Ratio Base 仅限内部使用。For internal use only.
Cache Object CountsCache Object Counts 高速缓存中高速缓存的对象数。Number of cache objects in the cache.
Cache PagesCache Pages 高速缓存对象所使用的 8 (KB) 页的数目。Number of 8-kilobyte (KB) pages used by cache objects.
Cache Objects in useCache Objects in use 正在使用的缓存对象数。Number of cache objects in use.

对象中的每个计数器均包含以下实例:Each counter in the object contains the following instances:

Plan Cache 实例Plan Cache instance 描述Description
_Total_Total 所有类型的缓存实例的信息。Information for all types of cache instances.
Sql 计划Sql Plans 由一个临时的 Transact-SQLTransact-SQL 查询(包括自动参数化查询)生成的查询计划,或使用 Transact-SQLTransact-SQL sp_prepare sp_cursorprepare 预备的语句生成的查询计划。Query plans produced from an ad hoc Transact-SQLTransact-SQL query, including auto-parameterized queries, or from Transact-SQLTransact-SQL statements prepared using sp_prepare or sp_cursorprepare. SQL ServerSQL Server 将临时的 Transact-SQLTransact-SQL 语句的计划存入缓存,以便将来需要执行相同的 Transact-SQLTransact-SQL 语句时再次使用。caches the plans for ad hoc Transact-SQLTransact-SQL statements for later reuse if the identical Transact-SQLTransact-SQL statement is later executed. 用户参数化的查询(即使未显式准备)也作为准备好的 SQL 计划监视。User-parameterized queries (even if not explicitly prepared) are also monitored as Prepared SQL Plans.
对象计划Object Plans 通过创建存储过程、函数或触发器而生成的查询计划。Query plans generated by creating a stored procedure, function, or trigger.
绑定树Bound Trees 视图、规则、计算列和检查约束的规范化树。Normalized trees for views, rules, computed columns, and check constraints.
扩展存储过程Extended Stored Procedures 扩展存储过程的目录信息。Catalog information for extended stores procedures.
临时表和表变量Temporary Tables & Table Variables 与临时表和表变量相关的缓存信息。Cache information related to temporary tables and table variables.

另请参阅See Also

“服务器内存”服务器配置选项 Server Memory Server Configuration Options
SQL Server Buffer Manager 对象 SQL Server, Buffer Manager Object
监视资源使用情况(系统监视器)Monitor Resource Usage (System Monitor)