Skip to content

Instantly share code, notes, and snippets.

@Mexidense
Created December 8, 2018 23:31
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 Mexidense/218c2ea59a9d0af00b5d74729702422e to your computer and use it in GitHub Desktop.
Save Mexidense/218c2ea59a9d0af00b5d74729702422e to your computer and use it in GitHub Desktop.
How to know table sizes on mysql for one DB
SELECT
TABLE_NAME AS `Table`,
ROUND((DATA_LENGTH + INDEX_LENGTH) / 1024 / 1024) AS `Size (MB)`
FROM
information_schema.TABLES
WHERE
TABLE_SCHEMA = "<NAME_DB>"
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