脳みそスワップアウト

揮発性なもので。おもにPHPのこととか。

テーブル、DBの容量

テーブル

SELECT 
  table_name "Table",
  engine, table_rows "Table Rows", 
  ( data_length + index_length ) / 1024 / 1024 / 1024 "Total (GB)",  
  ( data_length ) / 1024 / 1024 / 1024 "Data (GB)",  
  ( index_length ) / 1024 / 1024 / 1024 "Index (GB)",  
  ( data_free ) / 1024 / 1024 / 1024 "Free Space (GB)" 
FROM information_schema.TABLES 
WHERE table_schema=database() 
ORDER BY (data_length+index_length) desc limit 10;

DB

SELECT 
  table_schema "DB", 
  sum( table_rows ) "Table Rows",
  sum( data_length + index_length ) / 1024 / 1024 / 1024 "Total (GB)", 
  sum( data_length ) / 1024 / 1024 / 1024 "Data (GB)", 
  sum( index_length ) / 1024 / 1024 / 1024 "Index (GB)", 
  sum( data_free )/ 1024 / 1024 / 1024 "Free Space (GB)" 
FROM information_schema.TABLES 
GROUP BY table_schema;

ALTERの進捗行数確認

SHOW GLOBAL STATUS LIKE 'Handler_write';