Mysql – Find the largest table in specific database

Run the below query to find the largest table in your database. Please database_name value as your database name.

SELECT
TABLE_NAME AS `Table`,
ROUND(((DATA_LENGTH + INDEX_LENGTH) / 1024 / 1024),2) AS `Size (MB)`
FROM
information_schema.TABLES
WHERE
TABLE_SCHEMA = "database_name"
ORDER BY
(DATA_LENGTH + INDEX_LENGTH)
DESC;

I hope it helps.

About Bilal

I'm a software programmer, I handle Magento2 modifications at any level.

View all posts by Bilal →

Leave a Reply

Your email address will not be published. Required fields are marked *