Member-only story

How to Insert 100 million Data Quickly

Beck Moulton
5 min readJun 18, 2024

--

Hello, everyone, MySQL as a widely used open source relational database management system, there should be no Java development has not used it.

Regarding MySQL, we mostly talk about how to improve query efficiency. Today, let’s talk about how to improve MySQL insertion efficiency.

Ways to improve insertion efficiency

Generally, databases run on dedicated servers. The most obvious way to improve insertion efficiency is to improve server configuration.

For example, using high-performance CPUs and SSD disks, and using a distributed system architecture to distribute write pressure to multiple nodes. This method also has the highest cost, so bosses will certainly not use this method.

We can also start from other aspects:

  1. Adjust database configuration: optimize buffer pool size, increase batch insertion buffer, etc., by adjusting MySQL database parameters.
  2. Choose the MyISAMstorage engine because of its simple table locking mechanism and no transaction overhead, which performs better in insertion speed.
  3. Use batch insertion.

Considering the actual application scenario, the most likely thing we can do is to use the third implementation method to improve efficiency by batch insertion.

Explore Batch Insert

--

--

Beck Moulton
Beck Moulton

Written by Beck Moulton

Focus on the back-end field, do actual combat technology sharing Buy me a Coffee if You Appreciate My Hard Work https://www.buymeacoffee.com/BeckMoulton

No responses yet