Determining the size in megabytes of a MySQL table

Database

Committed to the LaraBrain by: wjgilmore (@wjgilmore) at December 12, 2016 6:46 pm

Calculate the size of a MySQL table using a simple query

To calculate the size of a MySQL table in megabytes, execute the following query:

SELECT 
  table_name AS `Table`, 
  round(((data_length + index_length) / 1024 / 1024), 2) `Size in MB` 
FROM information_schema.TABLES 
WHERE table_schema = "YOUR_DATABASE_NAME_HERE"
    AND table_name = "YOUR_TABLE_NAME_HERE";