I have a huge mysqldump file (~700GB) that I want to restore on a different server. For the first GBs, the import is quite fast with some MB/s, but after some GB of data, the speed drops to something between 50kb/s to 200kb/s.
Params for the mysqldump were --skip-comments --no-create-info --no-autocommit --quick --extended-insert --insert-ignore --compress
, so some speed improvements were done already.
Import is done by pv /file.sql | mysql -u USER DB
I also run mysqltuner and improved some of the settings there.
I’m wondering: Is it common for a mysqldump this large to have slow speeds after some time? Or is there anything that can be improved further?
2
Answers
When importing large volumes of data, the following should be disabled.
Because every time during an insert, the DB checks the relationships of the inserted record in other tables. And as tables get bigger and bigger, this process starts to slow down. Each time during an insert, the DB also performs an additional insert into the index of that table or runs insert triggers.
Also, because the transaction in MySQL is very weak, it is necessary to work so that commit does not work every time after insert, the commit command can be used, for example, once after every 10000 record inserts.
Rate Per Second = RPS
Suggestions to consider for your my.cnf [mysqld] section
Please view profile for contact info. Many more Global Variables could be significantly improved.
After a couple days of similar processing, let us know if better/worse for performance, please.