2

So I have worked with MySQL all my life (not as a DBAdmin, but a programmer), and I have some limited knowledge about maintaining MySQL databases.

Recently a portion of our database has been moved to MongoDB and we have outsourced MongoDB administration to another company. They informed us that with MongoDB, when data is deleted disk space is NOT recovered and that specific clean up tasks need to be done for this which require downtime.

What I wanted to ask here is that: They also said the same is applicable to MySQL (where if we delete data, disk space is not recovered and we need to run clean up scripts for that purpose). I was never aware about this regarding MySQL.

Can anyone tell me briefly how this works for MySQL or point me to any good resources that I can understand?

1 Answer 1

2

InnoDB

I have mentioned how to shrink InnoDB tables and the System Tablespace (ibdata1) in the past

MyISAM

You could simply run for mydb.mytable

OPTIMIZE TABLE mydb.mytable;

which will shrunk a MyISAM table and recalculate the index statistics. To shrink all MyISAM tables, see my Jul 24, 2012 answer to MySQL: reducing ibdata file size for MyISAM tables

GIVE IT A TRY !!!

1
  • awesome man! You get full marks for this answer :) Jun 16, 2015 at 18:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.