473,563 Members | 2,635 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

curious speed problem with java's resultSet getString

I ran into an interesting "problem" the other day when I was working
on a very simple zip code utility function.

I have a table in Oracle with the following columns: zipcode, state,
latitude, longitude.

My method calculates the distance from a given zipcode to all zipcodes
by doing the following:

1. select zipcode, latitude, longitude from zipcode_table;
2. while rs.next() calc distance
3. append to the string buffer if some simple condition.

Now, I noticed that the dang thing was slow. Like 3000 ms (table is
70K rows and I have a 10mb connection (this is an office lan)).

So I took out everything that was conditional and essentially changed
the method to get everything out of the database and keep appending it
to a string. What happens is that the time count goes like this:

1
2
4
.....70,000 records later...
23
423
424
424
424
425

Did you notice the crazy jump in the middle? This ALWAYS happens to
the last few numbers. I even put in some state restrictions in the
query and it still happens to the last few (sometimes the last 5
sometimes the last 10). And you know what? The offending method seems
to be the resultSet.getSt ring().

This sucks ass because its used all over the place in my application.
How can something like getString() taking so long at the end of the
iteration through the result set?

I await some insight into this seemingly crazed problem.

-sulla
Jul 17 '05 #1
1 4606

"Sulla" <su***@bonzomad rid.com> wrote in message
news:43******** *************** ***@posting.goo gle.com...
I ran into an interesting "problem" the other day when I was working
on a very simple zip code utility function.

I have a table in Oracle with the following columns: zipcode, state,
latitude, longitude.

My method calculates the distance from a given zipcode to all zipcodes
by doing the following:

1. select zipcode, latitude, longitude from zipcode_table;
2. while rs.next() calc distance
3. append to the string buffer if some simple condition.

Now, I noticed that the dang thing was slow. Like 3000 ms (table is
70K rows and I have a 10mb connection (this is an office lan)).

So I took out everything that was conditional and essentially changed
the method to get everything out of the database and keep appending it
to a string. What happens is that the time count goes like this:

1
2
4
....70,000 records later...
23
423
424
424
424
425

Did you notice the crazy jump in the middle? This ALWAYS happens to
the last few numbers. I even put in some state restrictions in the
query and it still happens to the last few (sometimes the last 5
sometimes the last 10). And you know what? The offending method seems
to be the resultSet.getSt ring().

This sucks ass because its used all over the place in my application.
How can something like getString() taking so long at the end of the
iteration through the result set?

I await some insight into this seemingly crazed problem.

-sulla


By appending to a string I hope you do not mean a String object and its +=
operator?

Silvio Bierman
Jul 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

17
4002
by: Shailesh Humbad | last post by:
I just posted an article I wrote called ASP Speed Tricks. It covers techniques to optimize output of database data in HTML, for both simple tables and complex tables. More advanced ASP authors might be interested in the complex table optimizations. Please check it out at: http://www.somacon.com/aspdocs/ Hope you enjoy, Shailesh
0
3574
by: anaik100 | last post by:
am trying to run a java db2 program. my db2 is in os/390. below is the code public class T4DB2Connect { public static void main(String args) { try { // load the DB2 Driver System.out.println("1" ); Class.forName("COM.ibm.db2os390.sqlj.jdbc.DB2SQLJDriver");
6
2505
by: eureka | last post by:
Hi friends, I am developing a web application using Jsp and JS. I have a main Jsp page(Jsp1).Inside it I have an iframe having an Html- table which is created dynamically and contains all records from the backend-table . For creating this dynamic table I've used another Jsp(Jsp2) and in Jsp1 I say: <iframe id = "I1" src="Jsp2.jsp"...
10
1832
by: sssk28 | last post by:
i have installed fedora core 6 and i am getting following error: type Exception report message description The server encountered an internal error () that prevented it from fulfilling this request. exception
21
3461
madhoriya22
by: madhoriya22 | last post by:
Hi, Here is the query which I am using to get the values from the database:- "SELECT ?, COUNT(*) AS COUNT " + "FROM DEFECT_DETAIL " + "WHERE TARGET_MILESTONE = ? " + "GROUP BY ?"; and here is function throught which I am getting data:-
1
3749
by: banging | last post by:
Hi there, I have a question regarding locking of tables so that when two or more people try to write or update the mysql tables, it locks up. Basically I only want one person to write to the file, but many are able to read the files (or tables entities). I am not sure if I need to lock the tables in my Java code or do I lock the tables...
3
6429
by: Ananthu | last post by:
Hi This is my codings in order to access mysql database from java. Codings: import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.Statement;
3
7692
by: Joshepmichel | last post by:
Please to help me to following problem I want to do this 1. create Table Name MEMBER on the Database Name "mytestdb", 2. Add the Values to the Table through the Key board Inputs during running the My Java Application.; Therefore I used this following codes, It Consists the seperate parts for the Raede and Member Class for the purposely I...
1
2480
by: swethak | last post by:
hi, when i run a java program for to store data and retrive using mysql datatabse i got the following errors.I think in that one of error is due to set the class path.I placed my mysql-connector-java-3.0.11-stable-bin jar in lib directory.What is the command to set a classpath in windows for java mysql connectivity.plz tell that .And also how...
0
7580
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7882
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8103
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
6244
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5481
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3634
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3618
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2079
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1194
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.