Find SQL Server Memory Use by Database and Objects

Amatya
Posted by Amatya under Sql Server category on | Points: 40 | Views : 418
Sometime for guy who involved in database field want to know SQL Server Memory Use by Database and Objects for the optimization and performance deeds, so this below query can help him

SELECT
[DatabaseName] = CASE [database_id] WHEN 32767
THEN 'Resource DB'
ELSE DB_NAME([database_id]) END,
COUNT_BIG(*) [Pages in Buffer],
COUNT_BIG(*)/128 [Buffer Size in MB]
FROM sys.dm_os_buffer_descriptors
GROUP BY [database_id]
ORDER BY [Pages in Buffer] DESC;


Hope it will help for them.
Thanks

Comments or Responses

Login to post response