Skip to content

Instantly share code, notes, and snippets.

@gquittet
Last active July 25, 2024 08:04
Show Gist options
  • Save gquittet/1f7b745c3a4ac364e981636421fd8f06 to your computer and use it in GitHub Desktop.
Save gquittet/1f7b745c3a4ac364e981636421fd8f06 to your computer and use it in GitHub Desktop.
List MySQL tables sizes
SELECT
TABLE_NAME AS `Table`,
ROUND((DATA_LENGTH + INDEX_LENGTH) / 1024 / 1024) AS `Size (MB)`
FROM
information_schema.TABLES
WHERE
TABLE_SCHEMA = 'my_database'
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