Skip to content

Instantly share code, notes, and snippets.

@bradfordpythian
Last active April 24, 2017 16:42
Show Gist options
  • Save bradfordpythian/67a7ffd43cd873326f4a2b5f16045153 to your computer and use it in GitHub Desktop.
Save bradfordpythian/67a7ffd43cd873326f4a2b5f16045153 to your computer and use it in GitHub Desktop.
List summary table type and size details.
SELECT @@hostname, DATABASE() as table_schema, CURDATE() AS today;
SELECT if(length(table_name)>30,concat(left(table_name,28),'..'),table_name) AS table_name,
engine,row_format as format, table_rows, avg_row_length as avg_row,
round((data_length+index_length)/1024/1024,2) as total_mb,
round((data_length)/1024/1024,2) as data_mb,
round((index_length)/1024/1024,2) as index_mb
FROM information_schema.tables
WHERE table_schema=DATABASE()
ORDER BY 6 DESC
LIMIT 15;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment