在 SQL Server 的 中sys.dm_os_memory_cache_entries,既可以查看缓存中条目的原始成本,也可以查看缓存条目的当前成本(original_cost和current_cost)。DMVsys.dm_os_buffer_descriptors包含当前内存中页面的记录以及有关页面的一些元数据。DVM 中没有的一大块有趣的信息是数据页的 LRU-K 值。
是否可以获取 SQL Server 缓冲池中数据页的 LRU-K 值?如果是这样,如何?
SQL Server 图形执行计划从右到左从上到下读取。生成的输出是否有有意义的顺序SET STATISTICS IO ON?
以下查询:
SET STATISTICS IO ON;
SELECT *
FROM Sales.SalesOrderHeader AS soh
JOIN Sales.SalesOrderDetail AS sod ON soh.SalesOrderID = sod.SalesOrderID
JOIN Production.Product AS p ON sod.ProductID = p.ProductID;
Run Code Online (Sandbox Code Playgroud)
生成这个计划:

这个STATISTICS IO输出:
Table 'Worktable'. Scan count 0, logical reads 0, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.
Table 'SalesOrderDetail'. Scan count 1, logical reads 1246, physical reads 3, read-ahead reads 1277, …Run Code Online (Sandbox Code Playgroud)