permaculture playing cards*
The moose likes JDBC and the fly likes Tips for Better JDBC querying Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Tips for Better JDBC querying" Watch "Tips for Better JDBC querying" New topic
Author

Tips for Better JDBC querying

Jack Daniel
Ranch Hand

Joined: Jun 15, 2002
Posts: 163
Hi e'body,

Well, I am in a project where you query {DB2} database tables, having more than a million records;

So what do you guys think is a better way to handle such a situation??

I anyway use DataSource Connection Pooling;
any tips on optimized ways of querying is greatly appreciated..!!

looking forward to hear from you guys.. i know, you guys have great ideas..
Thanks :-)

PS: if anyone can forward links where i can find optimized ways of querying, that would be great
[ September 13, 2004: Message edited by: Bear Bibeault ]
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 29247
    
139

Prashant,
The most important thing is well though out indexes. Also, run your queries through db2 explain to find optimizations.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Adeel Ansari
Ranch Hand

Joined: Aug 15, 2004
Posts: 2874
but indexes doesn't help in full table scan. i think we should avoid full table scans in these kind of situations.

tips:

- indexes help in query
- indexes may suck when there is lots of updates

so be careful
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 29247
    
139

Adeel,
I agree with what you said. As Prashant's table has millions of rows, a full table scan is unlikely to be occuring.
 
Consider Paul's rocket mass heater.
 
subject: Tips for Better JDBC querying
 
Similar Threads
could java have api for cryto in linux just like C/perl used?
how to optimize weblogic 5.1 server?
Preparing for SCJP
First time tweaker :o
* Winners: Patterns-Based Engineering