The following T-SQL query fetch the size of the buffer pool being used by as specific database.
1: select database_id, db_buffer_pages = COUNT_BIG(*) , db_buffer_MB = COUNT_BIG(*) / 1282: FROM sys.dm_os_buffer_descriptors3: WHERE DB_NAME([database_id]) = 'AdventureWorks2008'4: GROUP BY database_id
View the Buffer pool size of each object in the DB that was loaded to the memory pool
1: USE AdventureWorks2008;2: GO3:4: ;WITH src AS5: (6: SELECT7: [Object] = o.name,8: [Type] = o.type_desc,9: [Index] = COALESCE(i.name, ''),10: [Index_Type] = i.type_desc,11: p.[object_id],12: p.index_id,13: au.allocation_unit_id14: FROM15: sys.partitions AS p16: INNER JOIN17: sys.allocation_units AS au18: ON p.hobt_id = au.container_id19: INNER JOIN20: sys.objects AS o21: ON p.[object_id] = o.[object_id]22: INNER JOIN23: sys.indexes AS i24: ON o.[object_id] = i.[object_id]25: AND p.index_id = i.index_id26: WHERE27: au.[type] IN (1,2,3)28: AND o.is_ms_shipped = 029: )30: SELECT31: src.[Object],32: src.[Type],33: src.[Index],34: src.Index_Type,35: buffer_pages = COUNT_BIG(b.page_id),36: buffer_mb = COUNT_BIG(b.page_id) / 12837: FROM38: src39: INNER JOIN40: sys.dm_os_buffer_descriptors AS b41: ON src.allocation_unit_id = b.allocation_unit_id42: WHERE43: b.database_id = DB_ID()44: GROUP BY45: src.[Object],46: src.[Type],47: src.[Index],48: src.Index_Type49: ORDER BY50: buffer_pages DESC;51:
If I query the DB for the all tables
Deleting of the buffer poll can be done using the following DBCC:
DBCC DROPCLEANBUFFERS
Resources:
http://www.mssqltips.com/sqlservertip/2393/determine-sql-server-memory-use-by-database-and-object/
http://blog.extreme-advice.com/2012/11/24/find-buffer-pool-usage-of-database-in-sql-server/
אין תגובות:
הוסף רשומת תגובה