![Allure Web Solutions Code Snippet](https://allureprojects.com/app/uploads/sites/40/2017/03/allure-code-snippet.jpg)
This snippet queries your MySQL database for all tables and then returns their sizes sorted from largest to smallest.
Replace DATABASE
with the name of your database.
SELECT TABLE_NAME AS `Table`, ROUND((DATA_LENGTH + INDEX_LENGTH) / 1024 / 1024) AS `Size (MB)` FROM information_schema.TABLES WHERE TABLE_SCHEMA = "DATABASE" ORDER BY (DATA_LENGTH + INDEX_LENGTH) DESC;