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.

I am restoring a 30GB database from a mysqldump file to an empty database on a new server. When running the SQL from the dump file, the restore starts very quickly and then starts to get slower and slower. Individual inserts are now taking 15+ seconds. The tables are mostly MyISAM with one small InnoDB. The server has no other active connections. SHOW PROCESSLIST; only shows the insert from the restore (and the show processlist itself).

Does anyone have any ideas what could be causing the dramatic slowdown?

Are there any MySQL variables that I can change to speed the restore while it is progressing?

share|improve this question
Edited to correct the table types –  Dave Forgac May 29 '10 at 19:06

5 Answers 5

up vote 17 down vote accepted

One thing that may be slowing the process is the key_buffer_size, which is the size of the buffer used for index blocks. Tune this to at least 30% of your RAM or the re-indexing process will probably be too slow.

For reference, if you were using InnoDB and foreing keys, you could also disable foreing key checks and re-enable it at the end (using SET FOREIGN_KEY_CHECKS=0 and SET FOREIGN_KEY_CHECKS=1).

share|improve this answer
I found two things: the key_buffer_size was set to 8MB and there was one InnoDB table in the mix with foreign keys. Increased the key_buffer_size to 1GB and temporarily turned off foreign key checks. The restore finished in 5 minutes. Thanks! –  Dave Forgac May 29 '10 at 19:05
wow! Glad it helped :) –  Marco Ramos May 29 '10 at 19:11
I just noticed that I typed '5' minutes. I'm pretty sure it was more like 50 minutes but still way more reasonable ;-) –  Dave Forgac Mar 19 '13 at 4:18
key_buffer_size is for MYISAM. –  Fernando Fabreti Apr 3 '13 at 13:20

This link shows what one can do to speed up restoring process.


One can put put the commands at the top of the dump file


And put these statements at the end of the dump file


This worked for me. Happy restoring :-)

share|improve this answer

if you have multiple tables chances are you might benefit from mk-parallel-restore.

share|improve this answer

The only reason I can image why the restore would gradually slow down is indexing. Investigate turning off indexing until the end and then let it do the whole lot at once.

share|improve this answer

If you have the physical copy of the dump file (the DB directory), you can just copy it to the new server if the new server have the same MySQL version and it will work fine. This work fine with MyISAM and for me I think it is better than restoring the data based on the logical SQL dump file.

share|improve this answer

Your Answer


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.