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.

0 views

Follow Me

  • LinkedIn
  • Twitter
  • Facebook
  • YouTube
  • Instagram

©2020 by Bilal Usean. Proudly created with Wix.com