File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes limit result through JDBC Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "limit result through JDBC" Watch "limit result through JDBC" New topic

limit result through JDBC

avihai marchiano
Ranch Hand

Joined: Jan 10, 2007
Posts: 342

I need to go other around 100,000 rows (row has 7 columns from join between tables) in bulk of 500-1000, do my process (around 20 sec for bulk) and take additional bulk ....

My question:

from performance perspective should i leave the result set open or for each bulk create result set and set beginning (by absolute ) at the end of the last bulk row?

I understand that when you use "absolute" the database iterate over all rows until this point , dosnt the database has any algorithm to do this without iterate over all rows?

Thank you
Arunkumar Subramaniam

Joined: Apr 08, 2009
Posts: 8

you can use SQL cached row result set for achive your goal

like :

Arunkumar S
avihai marchiano
Ranch Hand

Joined: Jan 10, 2007
Posts: 342
If you have 1000 rows in the resultset, so it will copy all rows?
Jeanne Boyarsky
author & internet detective

Joined: May 26, 2003
Posts: 33102

Or you could use the SQL query itself to only return the rows you want to each connection is independent. Then you don't have to worry about using resources between requests. You could use rownum or the primary key of your table in the query.

[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
I agree. Here's the link:
subject: limit result through JDBC
It's not a secret anymore!