Created
August 18, 2016 13:22
-
-
Save crittermike/b1281d8e7d8bad4a86c8647fb82cc38e to your computer and use it in GitHub Desktop.
Determining size of MySQL DB dump and individual tables before dumping it
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_SCHEMA, | |
TABLE_NAME, | |
DATA_LENGTH / POWER(1024,1) Data_KB, | |
DATA_LENGTH / POWER(1024,2) Data_MB, | |
DATA_LENGTH / POWER(1024,3) Data_GB | |
FROM information_schema.tables WHERE table_schema NOT IN ('information_schema','performance_schema','mysql') ORDER BY DATA_LENGTH; |
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 | |
Data_BB / POWER(1024,1) Data_KB, | |
Data_BB / POWER(1024,2) Data_MB, | |
Data_BB / POWER(1024,3) Data_GB | |
FROM (SELECT SUM(data_length) Data_BB FROM information_schema.tables | |
WHERE table_schema NOT IN ('information_schema','performance_schema','mysql')) A; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment