• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Performance issue if I do not retrieve the rest of result set

 
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My result set is a huge list. And I want to reduce the data transfered between the Oracle database and my application. If I only retrieve the first few rows from the result set, and then just close the result set. Does all the data rows from the result set already transfered from Oracle to my application regardless that I didn't read these result set? Or is it the other way around, that only the data rows that I read, has actually transfered from Oracle to my application?
And does the Oracle database server already generate the full result set in its' memory before I read a single row of result set? Thanks.
Liang
 
Ranch Hand
Posts: 1879
MySQL Database Suse
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
For non-scrollable, Oracle will fetch into memory the number of records specified in the fetch size parameter. Once you need more records, the old records are discarded and the number of new records specified by the fetch size are loaded into memory. In general, A higher fetch size means more memory usage, but less calls to the database and vice versa. So at any time, with the ResultSet open or closed, the maximum number of records in memory is the number specified in the fetch size.
BEWARE!! Scrollable resultsets work a little differently. They generally work the same as non-scrollable except when you need more records, the old records are NOT discarded and the number of new records specified by the fetch size are loaded into memory. So at any time, with the ResultSet open, the maximum number of records in memory is the number of records you have iterated through rounded up to a multiple of the fetch size.
Not exactly sure what happens on Oracle, but I'm pretty sure they just have pointers ( in the general sense ) to the matched rows, the current one being the cursor.
Jamie
[ November 29, 2002: Message edited by: Jamie Robertson ]
reply
    Bookmark Topic Watch Topic
  • New Topic