Post

MySQL Database size

Cette requête permet de lister les bases de données MySQL et leur taille en octets, mégaoctets et gigaoctets.

This query lists MySQL databases and their size in bytes, megabytes, and gigabytes.

1
2
3
4
5
6
7
SELECT
    table_schema AS Database_Name,
    SUM(data_length + index_length) Size_In_Bytes,
    ROUND(SUM(data_length + index_length) / 1024 / 1024, 2) Size_In_MB,
    ROUND(SUM(data_length + index_length) / 1024 / 1024/ 1024, 2) Size_In_GB
FROM information_schema.tables
GROUP BY table_schema ORDER BY Size_In_Bytes DESC;
This post is licensed under CC BY 4.0 by the author.