BI SQL # 183 : SQL Server DBA Scripts : Pages per object in buffer pool
Hi Folks,
In this article we are going to cover Pages per object in buffer pool.
In this post we are going to discuss following points:
- Problem Statement of SQL Script:
- Description of SQL Script:
- SQL Script Output Column
- SQL Script Code
- SQL Script Output Screenshot
- User Level to execute
Problem Statement of SQL Script:
Find pages per object in buffer pool.
Description of SQL Script:
This Transact-SQL script lists buffer statistics for all Tables in the database.
SQL Script Output Column
SQL Script Code
SELECT SCH.NAME + '.' + OBJ.NAME AS ObjectName ,MAX(OBJ.type_desc) AS ObjectType ,IDX.NAME AS IndexName ,MAX(IDX.type_desc) AS IndexType ,OBD.page_type AS PageType ,COUNT(OBD.page_id) AS PagesInOsBuffer ,SUM(AU.total_pages) AS OfTotalObjectPages ,SUM(OBD.row_count) AS RowsInOsBuffer ,SUM(PRT.rows) AS OfTotalObjectRows FROM sys.dm_os_buffer_descriptors AS OBD INNER JOIN sys.allocation_units AS AU ON OBD.allocation_unit_id = AU.allocation_unit_id INNER JOIN sys.partitions AS PRT ON ( AU.container_id = PRT.partition_id AND AU.type = 2 ) OR ( AU.container_id = PRT.hobt_id AND AU.type IN ( 1 ,3 ) ) INNER JOIN sys.objects AS OBJ ON PRT.object_id = OBJ.object_id INNER JOIN sys.schemas AS SCH ON OBJ.schema_id = SCH.schema_id INNER JOIN sys.indexes AS IDX ON PRT.object_id = IDX.object_id AND PRT.index_id = IDX.index_id WHERE OBD.database_id = DB_ID() -- Only objec AND OBJ.type = 'U' -- Filter on user tables GROUP BY SCH.NAME ,OBJ.NAME ,IDX.NAME ,OBD.page_type ORDER BY PagesInOsBuffer DESC ,ObjectName ASC
SQL Script Output Screenshot
User Level to execute
300
Hope you will like to Pages per object in buffer pool.
If you really like reading my blog and understood at least few thing then please don’t forget to subscribe my blog.
If you want daily link and analysis or interesting link go to following website which will give @ your inbox please subscribe our following link resource blog :
For More information related to BI World visit my Mentalist Blog
SQL Server Mentalist >> SQL Learning Blog
Business Intelligence Mentalist >> BI World
Infographic Mentalist >> Image worth explaining thousand Words
Microsoft Mentalist >> MVC,ASP.NET, WCF & LinQ
DBA Mentalist >>Advance SQL Server Blog
Microsoft BI Mentalist >> MS BI Development Update
Connect With me on