Calculate table size and index size in Mysql
Calculate table size and index size in Mysql
mysql> SELECT table_name,`engine` ,ROUND(data_length/1024/1024,2) total_size_mb, ROUND(index_length/1024/1024,2) total_index_size_mb, table_rows FROM information_schema.TABLES WHERE table_schema = 'SalesDB' ORDER BY 3;
SalesDB -- Database namequery result
total_size_mb -- Total size in MB
table_name | engine | total_size_mb | total_index_size_mb | table_rows |
Customers | InnoDB | 0.45 | 0.11 | 1257 |
Invoices | InnoDB | 1.73 | 1.21 | 12785 |
Comments
Post a Comment