Skip to content
 

Optimisation of Java and JDBC

Just a quick post about a topic relevant to my current coursework.

I have been working on a project that requires the import of a large amount of legacy (initial) data into an SQL database, and then providing various searching facilities. Due to the size of the data, large amounts of queries are required and big data collections like ArrayLists are searched through. This inevitably means that it takes some time. Due to time constraints on the completion of the project I couldn’t improve on this.

However in the years to come on my course and professionally I’m sure it’ll be important to have an understanding of response times and when and how to improve on them.

From what I gather, optimisation (or optimization if you prefer!) is best only employed if absolutely needed.

I have found two very useful resources regarding this problem at JavaWorld:

http://www.javaworld.com/javaworld/jw-04-1997/jw-04-optimize.html

and also at PreciseJava:

http://www.precisejava.com/javaperf/j2ee/JDBC.htm

It is worth noting that NetBeans has a built in ‘profiler’ that can help with identifying bottlenecks, and simply getting and printing the system time between opertations is also quite useful.

SQL databases themselves are generally highly optimised, but if you’re running tons of queries it will inevitably slow things down. A pain though it is to those of us who find dont speak fluent SQL syntax, it really does improve systems if well constructed queries and transactions are made rather than fiddling things in Java or whatever language you’re using to communicate with the database.

Additionally Java and many other modern languages do take care of a lot of optimisation for you, which is all good stuff.

Leave a Reply