Created
October 14, 2016 00:36
-
-
Save xtfer/b09a119b04d293092de3360aeffe0d7e to your computer and use it in GitHub Desktop.
Estimate mysql size
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, | |
data_length/1048576,index_length/1048576, | |
(data_length+index_length)/1048576 as data_used, | |
data_free/1048576 as data_free, | |
(data_length+index_length+data_free)/1048576 as disk_used | |
FROM information_schema.tables where table_schema = 'main' | |
ORDER BY (data_length+index_length+data_free) ASC; | |
SELECT | |
SUM(index_length)/1048576 as index_length, | |
SUM(data_length)/1048576 as data_length, | |
SUM(data_free)/1048576 as data_free, | |
SUM(data_length+index_length+data_free)/1048576 as disk_used, | |
(COUNT(*) * 300 * 1024)/1048576 as overhead, | |
(SUM(data_length+index_length+data_free) + (COUNT(*) * 300 * 1024))/1048576+150 as estimated_actual_disk_usage | |
FROM information_schema.tables where table_schema = 'main'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment