If I have a simple Java program that generates a prepared statement to execute SQL like
select * from person
and this prepared statement returns a ResultSet
, what is the behavior when iterating through the result set if another process is writing rows to the person
table at the same time?
For example, will the newly added rows be visible inside the following loop
while (resultSet.next()) {
// Some processing
// Which might take a while
}
I have read elsewhere that it is possible to use setFetchSize
to control the number of rows that are returned in the ResultSet.
If I use this method does this change the answer? (assuming rows are written faster than they are read and processed)