In this short article i will share a simple query that i wrote to find the number of pages of a database in the buffer pool and there usage of the buffer pool
SELECT CASE database_id WHEN 32767 THEN 'ResourceDb' ELSE DB_NAME(database_id) END AS [Database],COUNT(*) AS PageCount , ( COUNT(*) * 8.0 ) / 1024 AS [SpaceOccupiedInBuffer-Mb] FROM sys.dm_os_buffer_descriptors GROUP BY database_id ORDER BY 3 DESC
Tagged: Buffer Pool, Data pages, Database, Microsoft SQL Server, SQL
Leave a Reply