Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

Without having to script an 'optimize table' query to do all the databases/tables, we would like to run mysqlcheck --optimize --all-database instead.

What are the drawbacks of doing this through mysqlcheck; both would defragment the tables, correct?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

mysqlcheck just runs a bunch of 'optimize table' SQL statements for you, so functionally they do the same thing.

Note that 'optimize table' for innodb just maps to an 'ALTER TABLE foo engine = innodb' statement. This rebuilds the entire table. Depending on the size of your table this may take a very long time, during which the table is locked and unavailable.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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