Is There Any Advantage In Using Addbatch() And Executebatch() Over Executing Multiple Queries Sequentially?
I came across a scenario where I have to insert 20 rows into a database (SQLite). The approach I followed was to create an update method which would take a String and a float and s
Solution 1:
Yes there is an performance advantage. Calling your update-method 20 times will execute 20 Insert-Statements.
Using the addBatch/executeBatch way, only one Insert-Statement gets executed which will insert 20 Lines at once, this is faster.
Allthough you might not recognize a difference with 20 Lines, you will with several 1000 Lines.
Post a Comment for "Is There Any Advantage In Using Addbatch() And Executebatch() Over Executing Multiple Queries Sequentially?"