Skip to content

Instantly share code, notes, and snippets.

@y2k-shubham
Created March 31, 2020 12:56
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 y2k-shubham/27c59631273536c8dfe6b9f716eb922f to your computer and use it in GitHub Desktop.
Save y2k-shubham/27c59631273536c8dfe6b9f716eb922f to your computer and use it in GitHub Desktop.
get size (raw-data) of all selected mysql tables
-- reference: https://stackoverflow.com/a/9620273/3679900
SELECT TABLE_NAME AS `Table`,
round(((data_length) / 1024 / 1024 / 1024), 2) `Size-in-GB`
FROM information_schema.TABLES
WHERE table_schema = 'my_db_name'
AND TABLE_NAME IN ('my_table_1',
'my_table_2')
ORDER BY (data_length) DESC
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment