Last active
December 18, 2015 06:59
-
-
Save bhathiya/5743211 to your computer and use it in GitHub Desktop.
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 | |
| IFNULL(B.engine,'Total') "Storage Engine", | |
| CONCAT(FORMAT(B.DSize/POWER(1024,pw),3),' ', SUBSTR(' KMGTP',pw+1,1),'B') "Data Size", | |
| CONCAT(FORMAT(B.ISize/POWER(1024,pw),3),' ', SUBSTR(' KMGTP',pw+1,1),'B') "Index Size", | |
| CONCAT(FORMAT(B.TSize/POWER(1024,pw),3),' ', SUBSTR(' KMGTP',pw+1,1),'B') "Table Size" | |
| FROM ( | |
| SELECT | |
| engine, | |
| SUM(data_length) DSize, | |
| SUM(index_length) ISize, | |
| SUM(data_length+index_length) TSize | |
| FROM information_schema.tables | |
| WHERE | |
| table_schema NOT IN ('mysql','information_schema','performance_schema') | |
| AND | |
| engine IS NOT NULL | |
| GROUP BY engine WITH ROLLUP) B, | |
| (SELECT 3 pw) A | |
| ORDER BY TSize; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment