Reputation: 221
In a Java program I am using a complex query (a select clause which has inner joins and sub queries). I am iterating over the result set and writing output in a text file.
Select clause output can be of 400,000 records. Will it cause any issue if the result set has these many records? Does ResultSet
has some record/memory limitations?
Upvotes: 0
Views: 322
Reputation: 7926
ResultSet itself is unbound. Your JVM process and network capabilities have limitations though. If you need to process lots of records from one query try to play around with ResultSet options available:
Statement stmt = con.createStatement("select * from dual", ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
stmt.setFetchSize(1000);
Based on your database and/or driver vendor, those could help you process request faster with less memory footprint.
Upvotes: 2