Changes between Version 7 and Version 8 of jazz/MySQL


Ignore:
Timestamp:
Feb 26, 2018, 2:27:20 PM (6 years ago)
Author:
jazz
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • jazz/MySQL

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