Mysql – Is it safe to repair and optimize thesql tables

MySQL

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.

Best Answer

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