0
我正在使用一个非常简单的设置从SELECT查询生成CSV文件。如何减少(或至少控制)查询锁定数据库读取的时间窗口?ResultSet:减少时间表被锁定的时间
下面是一个典型的例子:
private List<String[]> getData(final ResultSet rs) throws SQLException {
final List<String[]> res = new LinkedList<String[]>();
int i = 0;
int stride = 10;
while (rs.next()) {
if (++i % stride == 0) {
System.out.println("Row " + i);
}
if (i >= stride * 10) {
stride = stride * 10;
}
res.add(getRow(rs));
}
System.out.println("*** Total " + i + " rows");
return res;
}