MySQLサーバーを管理・メンテナンスするためのSQLメモです。
# 接続数 show status like '%connect%'; # クエリーキャッシュ show status like '%qcache%'; # スレッド show status like '%thread%'; # 上記全て show status where Variable_name like 'qcache%' or Variable_name like '%connections%' or Variable_name like 'thread%'
# 接続数 show variables like '%connect%'; # クエリーキャッシュ show variables like '%query_cache%'; # スレッド show variables like '%thread%'; # 上記全て show variables where Variable_name like '%query_cache%' or Variable_name like '%connections%' or Variable_name like 'thread%'
# innodb myisam 判別 select table_name, engine from information_schema.tables where table_schema = 'dbname'; # データベースごとのサイズ select table_schema, sum(data_length) as data_length, sum(index_length) as index_length, sum(data_length + index_length) /1024 /1024 as total_MB from information_schema.tables group by table_schema order by sum(data_length + index_length) desc; # テーブルごとのサイズ select table_name, engine, table_rows, avg_row_length, data_length /1024 /1024 as data_length_MB, index_length /1024 /1024 as index_length_MB, (data_length + index_length) /1024 /1024 as total_MB from information_schema.tables where table_schema = database() order by (data_length + index_length) desc;
Copyright(C) systemexpress.co.jp All Rights Reserved. Author Takayuki Yukawa