SELECT Statment to Determine Total Amount of Data

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.
LVL 2
learningtechnologiesAsked:
Who is Participating?
 
johanntagleCommented:
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
0
 
learningtechnologiesAuthor Commented:
Awesome.

Thank you very much!

/David C.
0
 
learningtechnologiesAuthor Commented:
Perfect! Exactly what I needed. Thank you!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.