I have a cursor returned from Database executes in 31ms (milliseconds) .
But when I use this cursor having more than 1500 rows for fetching rows
ResultSet rs = (ResultSet)cstm.getObject(6);
while(rs.next()){
system.out.println("...");
}
Just simple transversing through each row of cursor it’s taking more than 40 seconds (40000 ms)
What can be done?
Indeed, by default JDBC use a fetch size of 10.
Thus, if you don’t set a greater value, you’ll call database for next records exactly 150 times …, no need to explain drawbacks of round-trips.
All you have to do is to test performance by setting
fetchSizeto.. 100 for instance :You can play with this number to improve performance according to your environnement.