Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
25 lines (21 sloc) 808 Bytes
-- TO OBTAIN TOTAL BY DATABASE:
SELECT
IIF(database_id = 32767,'ResourceDB',DB_NAME(database_id)) AS [Database],
COUNT(row_count) AS cached_pages
FROM sys.dm_os_buffer_descriptors
GROUP BY database_id
ORDER BY cached_pages DESC;
--DETAILS BY DATABASE:
SELECT
IIF(database_id = 32767,'ResourceDB',DB_NAME(database_id)) AS [Database],
file_id, -- This File is at database level, it depends on the database you are executing the query
page_id,
page_level,
allocation_unit_id, -- can be joined with sys.allocation_units (database level DMO)
page_type,
row_count,
read_microsec
FROM sys.dm_os_buffer_descriptors BD
ORDER BY [Database], row_count DESC;
-- Check if you have a buffer pool extension enabled:
SELECT * FROM sys.dm_os_buffer_pool_extension_configuration;
You can’t perform that action at this time.