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.

When I try OPTIMIZE TABLE `table` (MyISAM) on a table which is about 300MB, then it is crashed and must be repaired. What could cause this problem? The same problem occurs on other tables over 300MB.

share|improve this question

migrated from stackoverflow.com Mar 31 '13 at 18:27

This question came from our site for professional and enthusiast programmers.

    
Did you try repairing the tables and retrying the OPTIMIZE? –  nneonneo Mar 31 '13 at 9:02
    
please provide MySQL server version, also show your my.cnf without comments (on Linux it would be /etc/my.cnf). –  mvp Mar 31 '13 at 9:02
    
Yes, after repair, optimize works. But next day, it crashs again. –  user2228872 Apr 3 '13 at 4:21
    
can you provide your server config (pysical server like memory/disk), does the mysql error log display any message? –  altmannmarcelo Apr 30 '13 at 19:47
add comment

1 Answer

MYISAM tables are very fragile and get damaged/crash every now and then. First advice is to move to Innodb engine it is simply performed by using alter table command.

Now, to fix crashed MYISAM tables the proper way is to bring the MYSQL down and once it is down and there is no traffic you can fix them using this command line statement:

myisamchk --silent --force --fast  /path/table-name.MYI

Trying to repair/optimise MYISAM tables on a live server usually does not work. From MYSQL CLI the command should be

mysql> repair table tablename;

instead of optimize table if the table was crashed.

share|improve this answer
    
Table crashes after optimize table. InnoDB would be better, but this is table for fulltext search. –  user2228872 Apr 3 '13 at 4:26
add comment

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.