Mysql Database and table sizes in Mb

Actual database size:

SELECT table_schema "Data Base Name", SUM( data_length + index_length) / 1024 / 1024 "Data Base Size in MB" FROM information_schema.TABLES GROUP BY table_schema ;

+--------------------+----------------------+
| information_schema |           0.00390625 |
| startnetdb         |          38.96961117 |
+--------------------+----------------------+

Table sizes:

SELECT TABLE_NAME, table_rows, data_length, index_length,  round(((data_length + index_length) / 1024 / 1024),2) as "Size in MB" FROM information_schema.TABLES

Returns:

| jos_newsfeeds                         |          0 |           0 |         1024 |       0.00 | 
| jos_ninjarsssyndicator                |          1 |          72 |         2048 |       0.00 |
| jos_ninjarsssyndicator_feeds          |          1 |         152 |         2048 |       0.00 |
| jos_ose_auth                          |          0 |           0 |         1024 |       0.00 |
| jos_ose_com                           |          0 |           0 |         1024 |       0.00 |
| jos_ose_secConfig                     |         12 |         308 |         2048 |       0.00 |
| jos_ose_secconfig                     |          0 |           0 |         1024 |       0.00 |
| jos_oseath_alerts                     |      14864 |     1396848 |       188416 |       1.51 |
| jos_oseath_l1rules                    |          0 |           0 |         1024 |       0.00 |
| jos_oseath_l2rules                    |      81250 |    13282220 |       836608 |      13.46 |
| jos_oseav_actionlogs                  |          0 |           0 |         1024 |       0.00 |

....

Leave a Reply