Calcular tamanhos para bancos de dados / tabelas

Tamanhos de banco de dados

SELECT TABLE_SCHEMA AS "DataBase Name", ROUND(SUM(DATA_LENGTH + INDEX_LENGTH) / 1024 / 1024, 2) AS "Size (in MB)" FROM information_schema.TABLES GROUP BY TABLE_SCHEMA;

Tamanhos de mesa

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 WHERE TABLE_SCHEMA = "table_name";