Skip to content

Instantly share code, notes, and snippets.

@ganapathichidambaram
Created February 13, 2021 13:21
Show Gist options
  • Save ganapathichidambaram/5d1adffd5e29a4ce4773b3a96eee7423 to your computer and use it in GitHub Desktop.
Save ganapathichidambaram/5d1adffd5e29a4ce4773b3a96eee7423 to your computer and use it in GitHub Desktop.
Get the Table Size along with Table Engine for particular SCHEMA/Database
SELECT
TABLE_NAME AS `Table`, ENGINE,
ROUND((DATA_LENGTH + INDEX_LENGTH) / 1024 / 1024) AS `Size (MB)`
FROM
information_schema.TABLES
WHERE
TABLE_SCHEMA = "DATABASENAME"
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