Speed up multiple JDBC SQL querys?
Posted
by paddydub
on Stack Overflow
See other posts from Stack Overflow
or by paddydub
Published on 2010-04-07T09:35:52Z
Indexed on
2010/04/07
9:43 UTC
Read the original article
Hit count: 244
I'm working on a shortest path a* algorithm in java with a mysql db. I'm executing the following SQL Query approx 300 times in the program to find route connections from a database of 10,000 bus connections. It takes approx 6-7 seconds to execute the query 300 times. Any suggestions on how I can speed this up or any ideas on a different method i can use ? Thanks
ResultSet rs = stmt.executeQuery("select * from connections" +
" where Connections.From_Station_stopID ="+StopID+";");
while (rs.next()) {
int id = rs.getInt("To_Station_id");
String routeID = rs.getString("To_Station_routeID");
Double lat = rs.getDouble("To_Station_lat");
Double lng = rs.getDouble("To_Station_lng");
int time = rs.getInt("Time");
}
© Stack Overflow or respective owner