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

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.

share|improve this question
    
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

1 Answer 1

up vote 1 down vote accepted

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.

//Christian

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.