How to improve the speed of insert into mysql

When mysql inserts data in large quantities, it will become very slow. There are three ways mysql can improve the insert into insert speed:

The first insertion speed-up method:

If there are already a lot of data in the database (several millions), you can increase the bulk_insert_buffer_size in the mysql configuration, this parameter defaults to 8M

  1. bulk_insert_buffer_size=100M

The second mysql insert speed-up method: 

Rewrite all insert into statements to insert delayed into

The difference of this insert delayed is that the result is returned immediately, and the insertion is processed in the background.

The third method: insert multiple pieces of data at once:

Insert multiple pieces of data in insert, for example:

insert into table values('11','11'),('22','22'),('33','33')...;

Reprint address: http://www.lao8.org/article_1480/mysql_insert_into#shuo

Guess you like

Origin blog.csdn.net/qq_42293496/article/details/86232723