Запрос для расчета размера таблиц начиная с MySQL 5.0:use information_schema;
SELECT concat(table_schema,'.',table_name),concat(round(table_rows/1000000,2),'M') rows,
concat(round(data_length/(1024*1024*1024),2),'G') DATA,
concat(round(index_length/(1024*1024*1024),2),'G') idx,
concat(round((data_length+index_length)/(1024*1024*1024),2),'G') total_size,
round(index_length/data_length,2) idxfrac
FROM TABLES ORDER BY data_length+index_length DESC LIMIT 10;
| concat(table_schema,'.',table_name) | rows | DATA | idx | total_size | idxfrac |
| art87.link_out87 | 37.25M | 14.83G | 14.17G | 29.00G | 0.96 |
#
| art87.article87 | 12.67M | 15.83G | 4.79G | 20.62G | 0.30 |
URL: http://www.mysqlperformanceblog.com/2008/02/04/finding-out-l.../
Обсуждается: http://www.opennet.me/tips/info/1581.shtml
Думаю, так будет красивее:use information_schema;
SELECT
concat(table_schema,'.',table_name) AS sql_table,
concat(round(table_rows/1000000,2),'M') rows,
concat(round(data_length/(1024*1024*1024),2),'G') DATA,
concat(round(index_length/(1024*1024*1024),2),'G') idx,
concat(round((data_length+index_length)/(1024*1024*1024),2),'G') total_size,
round(index_length/data_length,2) idxfrac
FROM TABLES
ORDER BY data_length+index_length DESC
LIMIT 10;+------------------------+--------+--------+--------+------------+---------+
| sql_table | rows | DATA | idx | total_size | idxfrac |
+------------------------+--------+--------+--------+------------+---------+
| dev.event_logs_backup2 | 75.83M | 14.39G | 13.31G | 27.70G | 0.93 |
| dev.event_logs_backup | 26.90M | 4.48G | 4.31G | 8.79G | 0.96 |
| dev.event_logs | 1.20M | 0.20G | 0.14G | 0.34G | 0.69 |
| mysql.help_topic | 0.00M | 0.00G | 0.00G | 0.00G | 0.05 |
| mysql.help_keyword | 0.00M | 0.00G | 0.00G | 0.00G | 0.18 |
| mysql.proc | 0.00M | 0.00G | 0.00G | 0.00G | 0.04 |
| mysql.help_category | 0.00M | 0.00G | 0.00G | 0.00G | 0.15 |
| mysql.help_relation | 0.00M | 0.00G | 0.00G | 0.00G | 2.11 |
+------------------------+--------+--------+--------+------------+---------+
10 rows in set (1.23 sec)