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 UI/UX Design

UI/UX Design by makandra brand

We make sure that your target audience has the best possible experience with your digital product. You get:

  • Design tailored to your audience
  • Proven processes customized to your needs
  • An expert team of experienced designers
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)