Recently, I worked a bit with a very similar situation. I had an application that would insert from 1 to several thousand records into a MySQL database.
To demonstrate (for yourself) the behavior of Magnus's connection pool in his answer, you can hack a quick application. Use the button and the click event to open (and then .close ()) the connection to your database, and then click the button to βre-openβ the connection several times after that. (Make sure you get some feedback so you know when (and if) .open () succeeded.) You will notice that the initial connection takes a few seconds, but subsequent attempts are very quick when the connection is taken from the pool.
Depending on what I needed to do, we ended up working with the "big" insert, creating a dynamic big insert statement for more "all or nothing", rather than individual insert statements. At some point, I had two versions of our program, which used separate inserts, as well as the volume insert method. In our situation, I did not see a noticeable difference in performance. (In fairness, there wasnβt even a ton of work)
source share