我有一个表存储图像位置,现在我想编写一个程序来读取这些图像的位置和下载图像,然后使用OCR从图像中读取文本。 问题是如何从表中读取超过一千万行到内存中?
String sql = "select * from t_image where some condition";
Statement s = ...;
ResultSet set = s.executeQuery(sql);
while(set.next()) {//row is too much, how to optimize here?
String location = set.getString("location");
}
答案 0 :(得分:1)
限制您的选择查询,使其仅返回x行数。然后继续它。