Is there a quick way to determine how much disk space a particular MySQL table is taking up? The table may be MyISAM or Innodb.
In linux with mysql installed by default:
[you@yourbox]$ ls -lha /var/lib/mysql/<databasename>
based on NIXCRAFT's mysql db location
You could perhaps look at the size of the files...
Each table is stored in a couple of separate files inside a folder that is named whatever you called your database. These folders are stored within the mysql data directory.
From there you can do a 'du -sh .*' to get the size of the table on disk.
I would just use 'mysqldiskusage' tool as follow
$ mysqldiskusage --server=user:password@localhost mydbname
# Source on localhost: ... connected.
# Database totals:
+------------+----------------+
| db_name | total |
+------------+----------------+
| mydbaname | 5,403,033,600 |
+------------+----------------+
Total database disk usage = 5,403,033,600 bytes or 5.03 GB
Quick bit of SQL to get the top 20 biggest tables in MB.
SELECT table_schema, table_name,
ROUND((data_length+index_length)/POWER(1024,2),2) AS tablesize_mb
FROM information_schema.tables
ORDER BY tablesize_mb DESC LIMIT 20;
Hope that's useful to somebody!
Taken from How do I check how much disk space my database is using?
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.
The below query will as well help to get the same information in bytes
select SUM(data_length) + SUM(index_length) as total_size
from information_schema.tables
where table_schema = 'db_name'
and table_name='table_name';
This won't be accurate for InnoDB tables. The size on disk is actually bigger than that reported via query.
Please see this link from Percona for more information.
https://www.percona.com/blog/2008/12/16/how-much-space-does-empty-innodb-table-take/