Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / Databases / July 2005

Tip: Looking for answers? Try searching our database.

Getting ResultSet From Cursor Too Slow

Thread view: 
Corey - 27 Jul 2005 20:57 GMT
All,

I have a method that calls an Oracle Stored Procedure from an Oracle
Package.  Everything works fine but the last two lines in my code below
where I get the Cursor from the procedure and cast it to a ResultSet is
a huge bottleneck.  Does anyone have any ideas on how to make this
transition faster for large resultSets?

Thanks in advance.

Corey

ResultSet rs = null;
Result r = null;

String sql = "{call SECINQ.GetUsersBasic(?, ?, ?, ?, ?, ?, ?, ?," +
                                "?, ?, ?, ?, ?, ?, ?, ?," +
                    "?, ?, ?, ?, ?, ?, ?, ?," +
                    "?, ?, ?, ?, ?, ?, ?, ?, ?)}";
open();

CallableStatement call = (CallableStatement)con.prepareCall(sql);
call.registerOutParameter(1, OracleTypes.CURSOR);

call.setString(2, name1);
call.setString(3, name2);
call.setString(4, name3);
call.setString(5, name4);

call.setString(6, geid1);
call.setString(7, geid2);
call.setString(8, geid3);
call.setString(9, geid4);

call.setString(10, ssn1);
call.setString(11, ssn2);
call.setString(12, ssn3);
call.setString(13, ssn4);

call.setString(14, userId1.toUpperCase());
call.setString(15, userId2.toUpperCase());
call.setString(16, userId3.toUpperCase());
call.setString(17, userId4.toUpperCase());

call.setString(18, userId1.toLowerCase());
call.setString(19, userId2.toLowerCase());
call.setString(20, userId3.toLowerCase());
call.setString(21, userId4.toLowerCase());

call.setString(22, userId1);
call.setString(23, userId2);
call.setString(24, userId3);
call.setString(25, userId4);

call.setString(26, phone1);
call.setString(27, phone2);
call.setString(28, phone3);
call.setString(29, phone4);

call.setString(30, flName1);
call.setString(31, flName2);
call.setString(32, flName3);
call.setString(33, flName4);

call.setFetchSize(200);

call.execute();

rs = (ResultSet)call.getObject(1);
               
r = ResultSupport.toResult(rs);
joeNOSPAM@BEA.com - 27 Jul 2005 22:02 GMT
what's the most important to you, the time to get
the result set, or the time it takes to process
the result set? If the former, don't set the fetch size,
and if the latter, set it to as many rows as you
expect. However, there's probably nothing much
you can do to make the DBMS faster when it is
sending you the data you ask for. Do try the very
latest 10G driver. It is faster than any previous.

Joe Weinstein at BEA
Corey - 27 Jul 2005 22:30 GMT
Can I use a 10g driver if I only use a 9i DB?  Where can I get that
driver?  I want the entire process to be fast.  The number of records
returned can range from 0 to a couple hundred thousand pretty easily.
Do you know of any good ways to balance the two options?  Thanks for
your help.

Corey
joeNOSPAM@BEA.com - 27 Jul 2005 23:08 GMT
Hi. You can download the 10G driver from oracle's site for free.
You should do two things:
1 - Make sure the table you query has an index that makes your query
fast
2 - Don't retrieve 200,000 records. You have to do something with
your architecture to prevent that. The number-one performance mistake
with DBMS applications is moving scads of raw data out to a client.
Unless you are going to present information to a user, or at the very
least, going to cache and re-use all this data for a long time in the
client so the DBMS doesn't have to repeat the query for a long time,
your application is just too wasteful. If you are wanting to process
this
data, much better/faster to do it in the DBMS in a stored procedure.

Joe Weinstein at BEA


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.