Hello All, I'm writing a swing application that contains about a dozen JTables that are each populated with data from an Oracle database. The database is huge and the queries that populate each table take a few seconds to run. Right now I just populate them one by one in a loop which is pretty slow. I'm playing around with spawning a thread for each table so they can all load at the same time, is this the right approach or are there tricks in JDBC that will let me run the queries simultaniously? Thanx Dave
Hi Dave, In the majority of cases, the best way to speed up SQL queries is to tune the SQL of the query itself, or to tune the database. There is a wealth of material available on tuning queries in Oracle databases. In fact, many people make a good living from merely tuning Oracle database queries. Oracle itself comes with tools that help you tune your queries. I don't think there are any "tricks" you can do with JDBC to speed up these queries. As regards using multi-threading, if you are on a single processor machine, I doubt whether multi-threading would help you. But I would suggest that there is only one way for you to find out for sure:- try it! In any case, an optimal performance would probably be gained by a combination of database tuning and (perhaps) multi-threading. But as far as I know, the only way to improve the performance is to use the tried and tested system of:
time it and see if the time it takes is acceptable
if it's not, profile it to find bottlenecks
refactor
repeat from step one (1), above
Good Luck, Avi.
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.