• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Can anybody help me in tuning Query in JDBC?

 
Muthu Ponmozhi
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear all,
this is about tuning the query in JDBC.Which is using 1000's of OR cases and now it became a performance problem . So i need to tune this by replacing some equvalent to many OR cases but with good performance result..

Thanks in Advance,
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 35279
384
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Muthu,
Can you give an example? (Maybe a subset of the query) In particular, are the or's using the same column?

For the future, we have a JDBC forum a few forums down for this type of question.
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving this to the JDBC forum...
 
Avi Abrami
Ranch Hand
Posts: 1141
1
Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Muthu,
Use:

[Look it up in the SQL manual for the RDBMS you are using.]

Good Luck,
Avi.
 
Muthu Ponmozhi
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all

thanks to everybody ...reg using "in" clause instead of "OR"clause we have some limitation i suppose in number of questionmarks used.(remember we have to use prepared statements only)..here the requirement in client;s environment is infinite...we cant limit the size of the in clause...what could be done for this...

Reg the existing OR clause :it is using same column only
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
IN clauses resolve to multiple OR statements anyway, so I don't see how you'll get any performance help using one. You will however get a performance hit, if your RDBMS is MSSQL where EXISTS is apparently more performant.

I'd argue that functionality which allows the user to create a query with 1000s of OR statements possibly needs to be reviewed, unless its unavoidable.
[ January 24, 2005: Message edited by: Paul Sturrock ]
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 35279
384
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Muthu,
I'm with Paul in questioning the design. If there are ranges, you can use "between" instead of or'ng all the choices.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic