3
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

MySQLのテーブル別サイズを確認したい

Posted at

やりたい事

  • mysqlでどのTABLEが大きいのか行数、サイズを確認したい

実行するSQL

実行するSQL
select
  table_name, engine, table_rows AS "レコード件数",
  avg_row_length AS "平均レコードサイズ(byte)",
  floor((data_length+index_length)/(1024*1024)) AS "テーブル全体(MB)",
  floor((data_length)/(1024*1024)) AS "データ(MB)",
  floor((index_length)/(1024*1024)) AS "インデックス(MB)"
FROM
  information_schema.tables 
WHERE
  table_schema=database()
ORDER BY
  (data_length+index_length) DESC;

参考サイト

3
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?