Skip to content

Instantly share code, notes, and snippets.

@ytkhs
Created January 23, 2017 09:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ytkhs/61b1c178648cf149f0fe521e3522a910 to your computer and use it in GitHub Desktop.
Save ytkhs/61b1c178648cf149f0fe521e3522a910 to your computer and use it in GitHub Desktop.
mysqlのテーブルごとのデータサイズを調べるときに使う
select
table_name,
engine,
table_rows,
avg_row_length,
floor((data_length+index_length)/1024/1024) AS MB
from
information_schema.tables
where
table_schema = 'DATABASE_NAME'
order by
(data_length+index_length) DESC
;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment