Wie findet man auf die Schnelle große Datenbanken und Tabellen in einem MySQL-Server?
mysql>
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 information_schema.TABLES ORDER BY data_length+index_length DESC LIMIT 10;
Beispiel-Ergebnis:
+-------------------------------------+-------+-------+-------+------------+---------+
| concat(table_schema,'.',table_name) | rows | DATA | idx | total_size | idxfrac |
+-------------------------------------+-------+-------+-------+------------+---------+
| nagios.nagios_servicechecks | 0.14M | 0.03G | 0.01G | 0.03G | 0.23 |
| nagios.nagios_systemcommands | 0.12M | 0.03G | 0.00G | 0.03G | 0.14 |
| nagios.nagios_timedevents | 0.15M | 0.01G | 0.01G | 0.02G | 1.02 |
| nagios.nagios_logentries | 0.03M | 0.00G | 0.00G | 0.00G | 0.08 |
| mysql.help_topic | 0.00M | 0.00G | 0.00G | 0.00G | 0.05 |
| db_nagiosql_v3.tbl_info | 0.00M | 0.00G | 0.00G | 0.00G | 0.17 |
| lilac.label | 0.00M | 0.00G | 0.00G | 0.00G | 0.05 |
| mysql.help_keyword | 0.00M | 0.00G | 0.00G | 0.00G | 0.18 |
| nagios.nagios_servicestatus | 0.00M | 0.00G | 0.00G | 0.00G | 1.45 |
+-------------------------------------+-------+-------+-------+------------+---------+
10 rows in set (0.02 sec)
mysql>