私の Java コードでは、select ステートメントを使用して Oracle データベース テーブルにアクセスします。大量の行 (約 50.000 行) を受け取るため、rs.next()すべての行を処理するには時間がかかります。
using ResultSet, the processing of all rows (rs.next) takes about 30 secs
私の目標は、このプロセスを高速化することです。そのため、コードを変更し、次を使用していCachedRowSetます。
using CachedRowSet, the processing of all rows takes about 35 secs
が呼び出されるたびに がデータを取得するのに対し、 は一度にすべてのデータを取得するため、CachedRowSetが通常の よりも遅い理由がわかりません。ResultSetCachedRowSetResultSetrs.next
コードの一部を次に示します。
try {
stmt = masterCon.prepareStatement(sql);
rs = stmt.executeQuery();
CachedRowSet crset = new CachedRowSetImpl();
crset.populate(rs);
while (rs.next()) {
int countStar = iterRs.getInt("COUNT");
...
}
} finally {
//cleanup
}