Mysql – Find the largest table in specific database
- Bilal Malik
- Jul 25, 2019
- 1 min read
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.
Comments