Suppose to have a ResultSet rs with n object.
This code:
while(rs.next()) {
// do something on rs
}
is algoritmically equal to this code (i.e. both gave the same result):
for(i=1; i<=n; i++) {
rs.absolute(i)
// do something on rs
}
But are this equivalant on terms of throughouts? Is the first faster? Or, for a given i, rs.next() is just a wrapper for rs.absolute(i+1)?
Best regards
MC
rs.nextdemands a simpler kind of database cursor (FORWARD_ONLY) thanrs.absoluteso in most cases you will degrade performance/resource efficiency withrs.absolute. In certain cases, where there is no optimization for aFORWARD_ONLYcursor anyway, you may get the same performance.Some drivers may allow
absolutecalls even withFORWARD_ONLY, validating that the requested record is the next one, but again others may throw an exception regardless.