Skip to Content

Database Memory Utilization (DB_Memory_utilization.sql)

Estimated Reading Time: < 1 Minute

Used to determine the amount of memory be used by all DataBases

 

SELECT DB_NAME(database_id) AS [Database Name],

COUNT(*) * 8/1024.0 AS [Cached Size (MB)]

FROM sys.dm_os_buffer_descriptors

--WHERE database_id > 4 -- system databases

--AND database_id <> 32767 -- ResourceDB

GROUP BY DB_NAME(database_id)

ORDER BY [Cached Size (MB)] DESC OPTION (RECOMPILE);

Database Memory Utilization (DB_Memory_utilization.sql)
  • COMMENT