This article is half-done without your Comment! *** Please share your thoughts via Comment ***
In this post, I am sharing a script for finding the size of Indexes in SQL Server.
I also shared different DBA scripts on SQL Server Indexes as Find the fragmentation of Indexes, Indexes Statistics.
SQL Server: Script to find Index Average Fragmentation in Percentage
Using the below script, you can get the size of indexes of a SQL database:
1 2 3 4 5 6 7 8 9 |
SELECT i.name AS IndexName ,SUM(s.used_page_count) * 8 AS IndexSizeInKB FROM sys.dm_db_partition_stats AS s INNER JOIN sys.indexes AS i ON s.[object_id] = i.[object_id] AND s.index_id = i.index_id WHERE s.[object_id] = object_id('dbo.Table_Name') GROUP BY i.name ORDER BY i.name |
Leave a Reply