Analyze, Repair and Optimize script

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
User avatar
JayBird
Admin
Posts: 4524
Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:

Analyze, Repair and Optimize script

Post by JayBird »

I am writing a maintenance-deamon which is executing CHECK TABLE, ANALYZE TABLE and OPTIMIZE TABLE once at night. If CHECK TABLE fails for at least one table, then the rest will be skipped.

The question is if the order of the statements is ok this way.

A second question would be, if I should run a REPAIR statement automatically if CHECK fails. Are there any more tasks that I should perform nightly in order to keep my database healthy and in a "high performance shape"?

And another general question: Do I have to take down my Application that is using the MySQL-DB in order to perform the
CHECK, ANALYZE and OPTIMZE commands?

Anyone got a scrip they use that does this?

Thanks

Mark
Post Reply