Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

My little 5GB database which takes 5 minutes to dump via mysqldump, takes 9 hours to restore. Luckily I found this out during a test-run, not an actual emergency situation.

What are the best parameters to optimize to speed this up?

I have tried the following settings on my server with 2GB of RAM:


The weird thing is that even with these aggressize settings, top only shows mysqld is barely using a fraction of the assigned memory:

 4421 mysql     20   0  247m  76m 5992 S   91  3.7   4:09.33 mysqld
share|improve this question

2 Answers 2

You should be able to compute these numbers before the mysqldump.

Concerning the settings you gave in the question,


This setting is WAY TOO BIG !!!

The innodb_log_file_size is supposed to be 25% of innodb_buffer_pool_size


Once you set this in /etc/my.cnf, you must do the following to resize your InnoDB log files:

  • Step 1) service mysql stop
  • Step 2) rm -f /var/lib/mysql/ib_logfile[01]
  • Step 3) service mysql start

As for the other setting


You never want to cache a ton of data in here before sending them to the InnoDB Log Files, especially for mysqldump reloads or heavy transactional COMMITs. The should be an order of magnitude smaller.


BTW You should disable binary logging before reloading. Otherwise, all the data lands in your binary logs. Please do one of the following:

Option 1) Make this -> 'SET SQL_LOG_BIN=0;' the first line of the mysqldump file.
Option 2) From mysql command line, run SET SQL_LOG_BIN=0; then run source < mysqldumpfile >
Option 3) comment out log-bin from /etc/my.cnf and restart mysql 5.1, load the mysqldump file, uncomment log-bin, and restart mysql

UPDATE 2011-07-24 20:30

If you have a mysqldump file /root/MyData.sql, you can still run the commands like this

mysql> SET SQL_LOG_BIN=0;
mysql> source /root/MyData.sql

This falls under Option 2

share|improve this answer
Some sql files can be awkward to edit and add "SET SQL_LOG_BIN=0;" Instead: echo "SET SQL_LOG_BIN=0;" | gzip > sql_log_bin.sql.gz; then run this: zcat sql_log_bin.sql.gz backup.sql.gz | mysql –  Andy Lee Robinson Jul 25 '11 at 0:16

Your problem is I/O, not memory. If you profile the disk, you'll find it thrashing madly to read and write, especially if it's on the same disk as the backup.

I'd move the file to a different physical drive and see if that helps.

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.