Many of you already know how to retrieve the size of your
dataset, schemas and tables in MySQL.
To summarize, below are the different queries you can run:
I the past I was using something like this :
But now with
sys schema being installed by default,
I encourage you to use some of the formatting functions provided
with it. The query to calculate the dataset is now:
SELECT sys.format_bytes(sum(data_length)) DATA,
sys.format_bytes(sum(data_length + index_length)) 'TOTAL SIZE'
FROM information_schema.TABLES ORDER BY data_length + index_length;
Let’s see an example: