Created
October 24, 2012 17:58
-
-
Save henricavalcante/3947712 to your computer and use it in GitHub Desktop.
SQL SERVER - Used disk space - Espaço usado por tabela em disco
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 object_name(id) AS name, | |
indid, | |
rowcnt AS rows, | |
reserved * 8 AS reserved_kb, | |
dpages * 8 AS data_kb, | |
(sum(used) * 8) - (dpages * 8) AS index_size_kb, | |
(sum(reserved) * 8) - (sum(used) * 8) AS unused_kb | |
FROM sysindexes | |
WHERE indid IN (0,1) -- cluster e não cluster | |
AND OBJECTPROPERTY(id, 'IsUserTable') = 1 | |
GROUP BY id, indid, rowcnt, reserved, dpages | |
ORDER BY rowcnt DESC |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment