We help IT Professionals succeed at work.

SELECT Statment to Determine Total Amount of Data

learningtechnologies
on
Hello everyone -

I used to have a select statement that I would copy and paste into the MySQL command line client that would return the total amount of data contained within the MySQL server databases.

It included the total data stored in addition to the data size of all indexes, etc.

It was excellent for planning how much space I would need during migrations.

However, I have lost access to that statement.

Would anyone be able to help me formulate a new select statement to address the above?

Thank you very much in advance.

/David C.
Comment
Watch Question

Top Expert 2012
Commented:
select table_schema, sum((data_length + index_length)/(1024*1024)) data_size
from information_schema.tables
group by table_schema;

This will give you size per database in MB.   Just adjust if you need to separate the data and index lengths
Awesome.

Thank you very much!

/David C.
Perfect! Exactly what I needed. Thank you!

Explore More ContentExplore courses, solutions, and other research materials related to this topic.