Find largest tables in a MySQL database
Published on
Sometimes, you need to find the largest tables in a MySQL database. There are a few ways to do this, but I think this is the easiest.
Run this query in MySQL to find the largest tables by size in GB:
SELECT table_schema AS "DB-name",
table_name,(data_length + index_length)/1024/1024/1024 AS "TableSizeinGB"
FROM information_schema.tables
WHERE table_schema='YOUR_SCHEMA' -- You can omit if you only have 1 schema in the DB
ORDER BY 10 DESC;