Read more

MySQL / MariaDB: Show disk usage of tables and columns

Thomas Eisenbarth
April 06, 2016Software engineer at makandra GmbH

You can find out about disk space usage of all tables within your database by running this:

SELECT table_name AS `Table`, round(((data_length + index_length) / 1024 / 1024), 2) `Size (MB)` FROM information_schema.TABLES WHERE table_schema = "$your_database";
Illustration online protection

Rails Long Term Support

Rails LTS provides security patches for old versions of Ruby on Rails (2.3, 3.2, 4.2 and 5.2)

  • Prevents you from data breaches and liability risks
  • Upgrade at your own pace
  • Works with modern Rubies
Read more Show archive.org snapshot

Replace $your_database here.

To find out the disk usage of a single column:

SELECT sum(char_length($your_column))/1024/1024 FROM $your_table

Result is in megabytes again.

Posted by Thomas Eisenbarth to makandra dev (2016-04-06 10:36)