-
-
Save voigt/c8a95ecbef22445187c3 to your computer and use it in GitHub Desktop.
MySQLL Table size as MB/GB...
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 TABLE_NAME AS "Table", | |
TABLE_ROWS AS "Rows", | |
CONCAT((FORMAT((DATA_LENGTH) / POWER(1024,2),2)), ' Mb') AS "Data Size", | |
CONCAT((FORMAT((INDEX_LENGTH) / POWER(1024,2),2)), ' Mb') AS "Index Size", | |
CONCAT((FORMAT((DATA_LENGTH+ INDEX_LENGTH) / POWER(1024,2),2)), ' Mb') AS "Total Size", | |
TRIM(TRAILING ', ' FROM CONCAT_WS(', ', ENGINE, TABLE_COLLATION, CREATE_OPTIONS)) AS "Type" | |
FROM information_schema.TABLES | |
WHERE information_schema.TABLES.table_schema = "schema_name" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment