Skip to main content

Get MySQL table size in MB (megabytes)

Change the table_schema "DB_NAME" with the name of the database you want to analyze.

SELECT table_name AS "Tables", 
       round(((data_length + index_length) / 1024 / 1024), 2) "Size in MB" 
FROM information_schema.TABLES 
WHERE table_schema = "DB_NAME"
ORDER BY (data_length + index_length) DESC;
Jorge Tutor

Jorge Tutor

CIO

Training courses

Face-to-face and online training for development and product teams.