Decrease MySQL database size after deleting records

I have a Mysql Database that I removed over 1,000,000 records from. Before record deletion, the database size was 408 MB. After I deleted all those records, guess how big it was? You’re right: 408 MB.

So to “reclaim” that space, first go to your favorite mysql query browser, and execute the query:

show table status;

It should show you all of your tables and information regarding those tables. One column should say “Data_free”. Look at what database has a large amount of “Data_free” space, and the excute another query:

optimize table YOURTABLENAMEHERE

 

After I had successfully optimized two tables, my database size went from 408 MB to 61 MB.

Now maybe my backups will work a little faster…

All the best,

Luke

Posted in Software | Tagged | 1 Comment