Created
August 28, 2012 01:30
-
-
Save madlep/3494112 to your computer and use it in GitHub Desktop.
MySQL query to list table sizes (index + data) for each schema
This file contains hidden or 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 | |
TABLE_NAME, | |
table_rows, | |
AVG_ROW_LENGTH, | |
data_length / 1024 /1024 / 1024 AS data_length_gb, | |
index_length / 1024 /1024 / 1024 AS index_length_gb, | |
(data_length / 1024 /1024 / 1024 + index_length / 1024 /1024 / 1024) AS total_length_gb | |
FROM information_schema.tables | |
ORDER BY table_schema, total_length_gb DESC; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment