Home > Link, Microsoft SQL Server, MSBI, Optimization, Query, Script, SQL Mentalist, SQL PraRup, SQL Query, SQL Server, Technology,, TSQL, Vishal Pawar > BI SQL # 183 : SQL Server DBA Scripts : Pages per object in buffer pool

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 = 
    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 (
    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 
    ORDER BY PagesInOsBuffer DESC
        ,ObjectName ASC

    SQL Script Output Screenshot


    User Level to execute


    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 :

Link Resource Website

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

| FaceBook |Twitter | linkedIn| Google+ | WordPress | RSS |

  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: