MySQL Database

ID #199

How do I check how much disk space my database is using?

Applies to: Grid System

You can check MySQL table size either by looking at phpMyAdmin in your control panel by clicking on the database name in the left frame and reading the size for the tables in there in the right frame, or instead, you can get a MySQL Monitor prompt and do:

show table status;

and look at the Data_length column for each table, which is in bytes.

This other FAQ tells you how we actually compute your disk usage.

Last update: 2010-10-03 16:26
Author: FAQ Admin
Revision: 1.2

Digg it! Share on Facebook Print this record Send FAQ to a friend Show this as PDF file
Please rate this FAQ:

Average rating: 3.07 (14 Votes)

completely useless 1 2 3 4 5 most valuable

You can comment this FAQ

Comment of Anonymous:
A quick script to show you how much disk space all your tables in a database are using:

Added at: 2002-12-24 19:08

Comment of Anonymous:
Actually if you really want to know the total disk usage, you need to add in the index_length as well as the data_length in the script above.
Added at: 2003-01-03 18:28

Comment of Anonymous:
If you simply want to know the total size, the query below will do the trick (in bytes):

select SUM(data_length) from information_schema.tables where table_schema = 'mydb';
Added at: 2009-05-25 02:09

Comment of Anonymous:
there is missing on the above comment.. it only summed the data_lenght.. it should be

select SUM(data_length) + SUM(index_length) as size from information_schema.tables where table_schema = 'mydb';
Added at: 2009-11-11 03:16