SELECT engine,

 SELECT engine,

count(*) TABLES,
concat(round(sum(table_rows)/1000000,2),'M') rows,
concat(round(sum(data_length)/(1024*1024),2),'M') DATA,
concat(round(sum(index_length)/(1024*1024),2),'M') idx,
concat(round(sum(data_length+index_length)/(1024*1024),2),'M') total_size,
round(sum(index_length)/sum(data_length),2) idxfrac
FROM information_schema.TABLES
GROUP BY engine
ORDER BY sum(data_length+index_length) DESC LIMIT 10;
 
mysql> SELECT engine,
    -> count(*) TABLES,
    -> concat(round(sum(table_rows)/1000000,2),'M') rows,
    -> concat(round(sum(data_length)/(1024*1024),2),'M') DATA,
    -> concat(round(sum(index_length)/(1024*1024),2),'M') idx,
    -> concat(round(sum(data_length+index_length)/(1024*1024),2),'M') total_size,
    -> round(sum(index_length)/sum(data_length),2) idxfrac
    -> FROM information_schema.TABLES
    -> GROUP BY engine
    -> ORDER BY sum(data_length+index_length) DESC LIMIT 10;
 
+--------+--------+----------+------------+-----------+------------+---------+
| engine | TABLES | rows     | DATA       | idx       | total_size | idxfrac |
+--------+--------+----------+------------+-----------+------------+---------+
| InnoDB |    514 | 2427.25M | 532911.78M | 42961.16M | 575872.94M |    0.08 |
| MyISAM |     32 | 0.65M    | 6.10M      | 19.69M    | 25.79M     |    3.23 |
| CSV    |      2 | 0.00M    | 0.00M      | 0.00M     | 0.00M      |    NULL |
| MEMORY |     28 | NULL     | 0.00M      | 0.00M     | 0.00M      |    NULL |
+--------+--------+----------+------------+-----------+------------+---------+
4 rows in set (6 min 43.92 sec)

你可能感兴趣的:(Engine,职场,select,休闲)