Tuesday, August 26, 2014

Script to identify index sizing without cross join


SELECT

    i.name                  AS IndexName,

    SUM(s.used_page_count) * 8   AS IndexSizeKB

FROM sys.dm_db_partition_stats  AS s

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('YOURTABLENAMEHERE')

GROUP BY i.name

ORDER BY i.name

 

No comments:

Post a Comment