Created
December 14, 2021 11:52
-
-
Save SBajonczak/0ef1b29447e8e7f422db4664763d71a2 to your computer and use it in GitHub Desktop.
Get Index Size for each table in the Database
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT i.[name] AS IndexName | |
,SUM(s.[used_page_count]) * 8 AS IndexSizeKB | |
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] | |
GROUP BY i.[name] | |
ORDER BY i.[name] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment