October 13, 2013 7:00 am
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
Find pages per object in buffer pool.
This Transact-SQL script lists buffer statistics for all Tables in the database.
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
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
Posted by Vishal Pawar
Categories: Link, Microsoft SQL Server, MSBI, Optimization, Query, Script, SQL Mentalist, SQL PraRup, SQL Query, SQL Server, Technology,, TSQL, Vishal Pawar
Tags: DBA, Fast SQL, Microsoft SQL Server, SQL Help, SQL Mentalist, SQL Script, SQL Server, SQL Server 2008 R2, SQL Server 2012, SQL tips, SQL Tricks, TSQL, Vishal Pawar
Mobile Site | Full Site
Get a free blog at WordPress.com Theme: WordPress Mobile Edition by Alex King.