SQL SERVER – DMV – For finding the Page count, index level, record count of an Index

This is a small post for finding the page count, index level and record count of an index. This script will definitely help you in Performance Tuning projects.

 

select i.name,i.type_desc,s.page_count,s.record_count,s.index_level from
sys.indexes i
inner join sys.dm_db_index_physical_stats(DB_ID(N'DatabaseName'),
object_id(N'TableName'),null,null,'Detailed')as s
on i.index_id = s.index_id
where i.object_id = object_id(N'dbo.TableName')

print

2 thoughts on “SQL SERVER – DMV – For finding the Page count, index level, record count of an Index

  1. Author’s gravatar

    Could not allocate space for object ‘dbo.Enquiry_Master’.’PK_Enquiry_Master’ in database ‘MasterDB’ because the ‘PRIMARY’ filegroup is full. Create disk space by deleting unneeded files, dropping objects in the filegroup, adding additional files to the filegroup, or setting autogrowth on for existing files in the filegroup.

    1. Author’s gravatar

      The issue is no space in your hard drive…! Remove unwanted databases or increase HDD space..!

      Reply

Leave a Reply

Your email address will not be published. Required fields are marked *


three × 3 =