groovy-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From adithyank <adi.k....@gmail.com>
Subject sql.withBatch(batchSize, query) {} does not give performance benefit. Inserts rows one by one in database
Date Thu, 17 May 2018 05:26:00 GMT
Team,

sql.withBatch(batchSize, query) {} does not give performance benefit.
Inserts rows one by one in database

Below is the code I used



The observations are below

1. The time taken to insert 10 lac rows is same as individual insert
statements that I was having previously
2. Also, in Database, the row count increases one by one and not in
multiples of 10000

I was expecting that 'Sql' class will commit the rows once for given batch
size. But, it did not happen that way. My expectation may be wrong !

So, I changed the code as below



This code gave expected my required performance. But, it is java way, not
groovyish way !!!

Is it wrong to expect this performance level from `sql.withBatch(batchSize,
query) {}` itself?



--
Sent from: http://groovy.329449.n5.nabble.com/Groovy-Dev-f372993.html

Mime
View raw message