Skip to content

Instantly share code, notes, and snippets.

@juliarose
Created May 8, 2022 20:44
Show Gist options
  • Save juliarose/e046e2f77405bba875effbfb10298147 to your computer and use it in GitHub Desktop.
Save juliarose/e046e2f77405bba875effbfb10298147 to your computer and use it in GitHub Desktop.
mysql database table sizes
SELECT
TABLE_NAME AS `Table`,
ROUND((DATA_LENGTH + INDEX_LENGTH) / 1024 / 1024) AS `Size (MB)`
FROM
information_schema.TABLES
WHERE
TABLE_SCHEMA = "name_of_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