Showing posts with label mysql. Show all posts
Showing posts with label mysql. Show all posts

Thursday, October 06, 2011

Speeding up mysql restoration of data

Mysql restoration too slow? Try the following steps:

1. Open the file my.ini inside the MySQL installation directory and do the following:

(a) Search for innodb_buffer_pool_size and set it to approx 20% of your RAM. I set it to 500M.
innodb_buffer_pool_size=500M

(b) Search for innodb_flush_log_at_trx_commit and change it from 1 to 2:
innodb_flush_log_at_trx_commit=2

(c) Search for key_buffer_size and set it to approx 20% of your physical RAM.
key_buffer_size=1200M

(d) In your data.sql file you are trying to restore, if it is an innodb tables, try to modify it and add the lines:
SET FOREIGN_KEY_CHECKS=0 // At the beginning

...
SET FOREIGN_KEY_CHECKS=1 // At the end of the file

Now restart MySQL service.

Start restoring data. It will be approximately a magnitude of 50 times faster.