Java 5 minutes to insert tens of millions of data

Although the insertion may not be completed in 5 minutes, it depends on the inserted fields. If there are too many fields, it will be a little slower, but not too slow. The results can be seen in 10 minutes.

Before, I tried to use multithreading to realize data insertion (millions of data), and it took more than 200000 data in more than half an hour.

Thread pool data insertion core code:

Application scenario: create test data, such as tens of millions or even hundreds of millions of levels of data, which are automatically and quickly generated. The key core implementation class codes are as follows:

Code principle: insert 1000 pieces of data, submit it once, and then repeat it 10000 times.

Key core Dao:

XML:

Reference link: [mybatis] insert 10 million pieces of data into MySQL database in five minutes. The batch insertion takes about 5 minutes

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>