Created
March 28, 2022 18:10
-
-
Save bfodeke/84f33f17b460a5d80f4a8bbe524d4b6c to your computer and use it in GitHub Desktop.
Query the database to view tables by size. Replace `[database_name]` with the name of your database
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT table_name AS 'Table', TABLE_ROWS as 'Num. of Rows', round(((data_length + index_length) / 1024 / 1024), 2) 'Size in MB' | |
FROM information_schema.TABLES where table_schema = '[database_name]' | |
ORDER BY (data_length + index_length) DESC | |
LIMIT 200; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment