Skip to content

Instantly share code, notes, and snippets.

@froemken
Created August 3, 2021 09:23
Show Gist options
  • Save froemken/921968eca6ae5eeb4410e9afcca1cfd5 to your computer and use it in GitHub Desktop.
Save froemken/921968eca6ae5eeb4410e9afcca1cfd5 to your computer and use it in GitHub Desktop.
SQL Query to get size in MB for data and index of given database name
SELECT table_name AS "Table", ROUND((data_length / 1024 / 1024), 2) AS "Data size (MB)", ROUND((index_length / 1024 / 1024), 2) AS "Index size (MB)"
FROM information_schema.TABLES
WHERE table_schema = "[database_name]"
ORDER BY data_length DESC
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment