Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

Couple of days back I had a table with 7GB of data and it was showing 63MB of overhead in phpMyAdmin and I mistakenly started its optimization and after working of more than 40 mins it corrupted the whole table.

What are the safe practices to avoid table crash?

share|improve this question

1 Answer 1

up vote 4 down vote accepted

I would say to try to use a different storage engine like InnoDB.

It sounds like you were using MyISAM which isn't crash safe. If you want to continue using MyISAM and it crashes in the future, you can fix it with an external program called myisamchk.

http://dev.mysql.com/doc/refman/5.0/en/myisamchk.html

 myisamchk --force --key_buffer_size=512M --sort_buffer_size=64M --read_buffer_size=8M --write_buffer_size=8M  /path/to/datadir/*/*.MYI
share|improve this answer
    
Any idea how long it will take to repair 7GB table? –  Rick James Sep 14 '11 at 19:12
1  
It really depends on your system, but myisamchk has parameters, like increasing memory it can use which can make it faster. –  Jonathan Sep 14 '11 at 20:10
1  
thx, wanted to give rep but I lack points. :) –  Rick James Sep 14 '11 at 20:34
    
+1. Nice info about myisamchk. –  StanleyJohns Sep 14 '11 at 22:19

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.