File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes How to make a query faster. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "How to make a query faster." Watch "How to make a query faster." New topic

How to make a query faster.

Gorakshanath Pandey

Joined: Feb 25, 2004
Posts: 11
I have a sql query which works well. but the only problem with it
is its extremely slow.Its a compound query and i have to query DB2
database.I am using Java/JDBC to write a stored procedure
David Peterson
Ranch Hand

Joined: Oct 14, 2001
Posts: 154
You need to identify the bottleneck: is it JDBC or DB2? Run the query from a command-line tool (i.e. not through JDBC). Is it still as slow?
Jeanne Boyarsky
author & internet detective

Joined: May 26, 2003
Posts: 32818

Did you try adding indexes to your table? Also, try posting the query. Maybe someone here can give you tips on it.

[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
It is sorta covered in the JavaRanch Style Guide.
subject: How to make a query faster.
It's not a secret anymore!