Recreation of DB using "mysql mydb < mydb.sql" is really slow when the table has tens of millions of

Posted by Jian Lin on Stack Overflow See other posts from Stack Overflow or by Jian Lin
Published on 2010-06-09T01:58:26Z Indexed on 2010/06/09 2:02 UTC
Read the original article Hit count: 240

It seems that a MySQL database that has a table with tens of millions of records will get a big INSERT INTO statement when the following

mysqldump some_db > some_db.sql

is done to back up the database. (is it 1 insert statement that handles all the records?)

So when reconstructing the DB using

mysql some_db < some_db.sql

then the CPU is hardly busy (about 1.8% usage by the mysql process... I don't see a mysqld either?) and also the hard disk doesn't seem to be too busy...

Last time, the whole restore process took 5 hours. Is there a way to make it faster? Such as, when doing mysqldump, can it break the INSERT statement into shorter ones, so that the mysql doesn't need to parse the line so hard when restoring the DB?

© Stack Overflow or respective owner

Related posts about mysql

Related posts about mysqldump