On ne of the websites - it is written to improve performance one should set the "fetchSize" of the prepared statement and ResultSet.
1 >Lets say if I set a fetch size of 10 and my query returns 20 records - are all records held in memory or only 10 are in memory and when I iterate to the 11th record - then the remaining are fetched from database ?
Forgot to mention: I would advise against making the fetch size smaller than the default.
Joined: Dec 26, 2005
Thanks Jeanne for your replies .
So when you say there will be two trips to the database : 1 >Where is the resultset stored - is that stored in SGA ( In case of Oracle ) 2 >If we are using a resultset - then believe all the data is anyway on the server side ( not like disconnected rowset )
So are you saying that after query execution ( results obtained = 20 rows & fetchSize = 10 ) that 20 rows will be stored in SGA
So where are the first 10 records read / picked from
What happens when we access the 11th record ?
Too many questions and too much confusion at my end .
Any answers will be greatly appreciated .
author & internet detective
I don't know about what is stored in SGA. That is within Oracle, so I don't need to think about it as an app developer.
> If we are using a resultset - then believe all the data is anyway on the > server side ( not like disconnected rowset ) It's on the client side too. When you call rs.next(), the data is transfered to the client side. We wouldn't want this to happen on every call to rs.next() so fetch size tells the driver how often to go to the server to get more data.