Skip to content

Instantly share code, notes, and snippets.

@xiaozhiliaoo
Created February 22, 2020 05:14
Show Gist options
  • Save xiaozhiliaoo/b293bc9e7015f3f0e8b46e4590d04fbf to your computer and use it in GitHub Desktop.
Save xiaozhiliaoo/b293bc9e7015f3f0e8b46e4590d04fbf to your computer and use it in GitHub Desktop.
quick look up a db size
SELECT table_schema,
SUM(data_length+index_length)/1024/1024 AS total_mb,
SUM(data_length)/1024/1024 AS data_mb,
SUM(index_length)/1024/1024 AS index_mb,
COUNT(*) AS tables,
CURDATE() AS today
FROM information_schema.tables
GROUP BY table_schema
ORDER BY 2 DESC;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment