Skip to content

Instantly share code, notes, and snippets.

@jethroo
Last active February 25, 2021 09:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jethroo/2887e42235798d7c709e2a7b12d5df38 to your computer and use it in GitHub Desktop.
Save jethroo/2887e42235798d7c709e2a7b12d5df38 to your computer and use it in GitHub Desktop.
Getting table size MB in MySQL for a specific schema
SELECT
TABLE_NAME AS `Table`,
ROUND((DATA_LENGTH + INDEX_LENGTH) / 1024 / 1024) AS `Size (MB)`
FROM
information_schema.TABLES
WHERE
TABLE_SCHEMA = "<schema_name>"
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