Skip to content

Instantly share code, notes, and snippets.

@thewinterwind
Created February 3, 2014 20:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thewinterwind/8791553 to your computer and use it in GitHub Desktop.
Save thewinterwind/8791553 to your computer and use it in GitHub Desktop.
View details on MySQL tables
SELECT count(*) tables,
concat(round(sum(table_rows)/1000000,2),'M') rows,
concat(round(sum(data_length)/(1024*1024*1024),2),'G') data,
concat(round(sum(index_length)/(1024*1024*1024),2),'G') idx,
concat(round(sum(data_length+index_length)/(1024*1024*1024),2),'G') total_size,
round(sum(index_length)/sum(data_length),2) idxfrac
FROM information_schema.TABLES;
+--------+----------+---------+--------+------------+---------+
| tables | rows | data | idx | total_size | idxfrac |
+--------+----------+---------+--------+------------+---------+
| 1538 | 1623.91M | 314.00G | 36.86G | 350.85G | 0.12 |
+--------+----------+---------+--------+------------+---------+
1 row in set (52.56 sec)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment