Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

3 Answers 3

up vote 2 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

 
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.