When using a ScrollableResults
, does a call to last()
move directly to the last record or is it stepping through each record until it reaches the last one? E.g. is it performant, or not?
This is for MySQL 8 via the MySQL Connector for Java. Goal here is to get a total record count w/out issuing a second COUNT() query and also not iterating every record, and certainly not bringing them all into memory.
// just skip to the last record, don't pull each from the DB (??)
scrollableResultSet.last();
totalCount = scrollableResultSet.getRowNumber() + 1;