Skip to content

Instantly share code, notes, and snippets.

@jcook793
Created September 21, 2016 20:16
Show Gist options
  • Save jcook793/9f14ccc3afe8de8f9790a8ae4a9ceccb to your computer and use it in GitHub Desktop.
Save jcook793/9f14ccc3afe8de8f9790a8ae4a9ceccb to your computer and use it in GitHub Desktop.
Get table sizes from MySQL
select table_schema as 'schema',
table_name as 'table',
round(((data_length + index_length) / 1024 / 1024 / 1024), 0) 'gigs',
round((data_length + index_length) /
(select sum(data_length + index_length)
from information_schema.tables) * 100, 0) 'percent'
from information_schema.tables
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