Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 464
  • Last Modified:

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.
  • 2
1 Solution
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
learningtechnologiesAuthor Commented:

Thank you very much!

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

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now