curious speed problem with java's resultSet getString - Java
This is a discussion on curious speed problem with java's resultSet getString - Java ; 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 ...
-
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.getString().
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
-
Re: curious speed problem with java's resultSet getString
"Sulla" <sulla@bonzomadrid.com> wrote in message
news:43aa4605.0407010718.76aee694@posting.google.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.getString().
>
> 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
Similar Threads
-
By Application Development in forum Microsoft Money
Replies: 2
Last Post: 08-23-2007, 05:10 AM
-
By Application Development in forum ODBC
Replies: 0
Last Post: 06-10-2005, 03:17 AM
-
By Application Development in forum JDBC JAVA
Replies: 2
Last Post: 05-11-2005, 02:15 AM
-
By Application Development in forum JDBC JAVA
Replies: 23
Last Post: 03-18-2005, 10:31 AM
-
By Application Development in forum Microsoft Exchange
Replies: 2
Last Post: 06-03-2004, 01:34 PM