Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I use mysqltuner to tune the mysql server. It recommends to "Run OPTIMIZE TABLE to defragment tables for better performance". I had done this on a single database before and I don't see any problem. Now, I have several client's databases on this server, I am hesitate to use optimize and repair on all databases. Is it safe to do this? Should I optimize their databases or ask them to do it? Thanks.

share|improve this question
up vote 3 down vote accepted

I'd rather leave it to customers if only for the reason OPTIMIZE TABLE locks the table for the duration of the operation.

share|improve this answer
Thanks. I will leave it to customers to do it. – garconcn Jul 5 '12 at 19:30

I've never had a problem with it. I'd say it's about as safe as anything else in MySQL.

share|improve this answer

I'd definitely schedule this for a quiet/off-peak time, and do a database dump beforehand and immediately after, and compare if possible.

of course, you might want to consider whether there's a reason the DB performance is dropping off and look at the mysql slow query log to see if a new table layout would prevent problems happening.

share|improve this answer

Your Answer


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.