| 97 | * 顯示 InnoDB 跟 MyISAM 各自儲存了多少資料量 |
| 98 | {{{ |
| 99 | mysql> SELECT IFNULL(B.engine,'Total') "Storage Engine", |
| 100 | CONCAT(LPAD(REPLACE(FORMAT(B.DSize/POWER(1024,pw),3),',',''),17,' '),' ', |
| 101 | SUBSTR(' KMGTP',pw+1,1),'B') "Data Size", CONCAT(LPAD(REPLACE( |
| 102 | FORMAT(B.ISize/POWER(1024,pw),3),',',''),17,' '),' ', |
| 103 | SUBSTR(' KMGTP',pw+1,1),'B') "Index Size", CONCAT(LPAD(REPLACE( |
| 104 | FORMAT(B.TSize/POWER(1024,pw),3),',',''),17,' '),' ', |
| 105 | SUBSTR(' KMGTP',pw+1,1),'B') "Table Size" |
| 106 | FROM (SELECT engine,SUM(data_length) DSize,SUM(index_length) ISize, |
| 107 | SUM(data_length+index_length) TSize FROM information_schema.tables |
| 108 | WHERE table_schema NOT IN ('mysql','information_schema','performance_schema') |
| 109 | AND engine IS NOT NULL GROUP BY engine WITH ROLLUP) B, |
| 110 | (SELECT 3 pw) A ORDER BY TSize; |
| 111 | }}} |