We run a forum with some 2 million posts and I've noticed that if left untouched the overhead in the mySQL (as listed in phpMyAdmin) can get quite large (hundreds of megabytes).

I'm wondering if scheduling a normal mysqlcheck to optimize the tables is good practice? Any reason not to do it, say, once a week at an off-peak hour?

There was a time over the summer where our site was constantly crashing because mysql was using up all resources. That's when I noticed the huge amount of overhead and optimized the database and haven't had any problems since then with stability. I figured if that was helping alleviate the issues, I should just setup a cron to automatically do this.

  • What do you mean by "overhead"? Please be a lot more specific about the issue. You might also tell us something relevant about the system, such as what forum software you're running (many are very buggy), what version of MySQL and what kinds of tables. – John Gardeniers Oct 19 '12 at 22:54

The reason not todo so mysqlcheck unless needed would be that mysqlcheck acquires read locks on the database which prevents writes to the locked table as long as the read lock is held.

If the forum gets unavailable then it would make sense to schedule mysqlcheck via cron but not so often.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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