Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

join vs sub query

 
Ramakrishna Bysani
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I have two large tables. I have particular problem for which i can choose either join or sub query, which one is better? Shall i need to consider the dbms optimization when selecting my strategy? What are the pro and cons in selecting one.

Thanks in advance

--Ramki
(SCJP--93%)(preparing for SCWCD)
 
Edwin Keeton
Ranch Hand
Posts: 214
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It all depends. On the specific database engine, the size of the tables, whether the subquery is correlated or non-correlated, whether the joins are on indexed columns, and so on and so on.

If the join is on an index, I would probably use a join. But this is the kind of thing I wouldn't spend much time worrying about unless there was a definite performance problem.
 
Bysani Ramakrishna
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Edwin
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic