How to insert a very large number of records into a MySql database as fast as possible

后端 未结 4 492
庸人自扰
庸人自扰 2020-11-30 15:00

I have a database table like below:

create table temperature
(id int unsigned not null auto_increment primary key,
temperature double
);

An

4条回答
  •  被撕碎了的回忆
    2020-11-30 15:35

    you can use the concept of bulk insert which executes many inserts at the same time minimizing overhead of calling ExecuteNonQuery multiple times.

    in MySQL this is called LOAD DATA, check here for details: http://dev.mysql.com/doc/refman/5.5/en/load-data.html

    in MS SQL Server this is called bulk insert and it's known as such, that's why I've mentioned it with this name.

提交回复
热议问题