Recreation of MySQL DB using "mysql mydb < mydb.sql" is really slow when the table has tens of milli
- by Jian Lin
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?