SELECT
table_schema AS 'Baza',
ROUND(SUM(data_length) / 1024 / 1024, 2) AS 'Dane (MB)',
ROUND(SUM(index_length) / 1024 / 1024, 2) AS 'Indeksy (MB)',
ROUND(SUM(data_length + index_length) / 1024 / 1024, 2) AS 'Razem (MB)'
FROM information_schema.TABLES
GROUP BY table_schema
ORDER BY SUM(data_length + index_length) DESC;