Thread: how sub queries and joins differs funcationally

how sub queries and joins differs funcationally

From
"shreedhar"
Date:
Can any body tell that how sub queries and joins differs funcationally.
Because sub queries taking lot of time than joins.

Regards,
Sreedhar

"Faith, faith, faith in ourselves, faith, faith in God, this is the secret
of greatness.
If you have faith in all the three hundred and thirty millions of your
mythological gods,
and in all the gods which foreigners have now and again introduced into your
midst,
and still have no faith in yourselves, there is no salvation for you. "
(III. 190)


Re: how sub queries and joins differs funcationally

From
Ludwig Lim
Date:
Hi shreedhar :

--- shreedhar <shreedhar@lucidindia.net> wrote:
> Can any body tell that how sub queries and joins
> differs funcationally.
> Because sub queries taking lot of time than joins.
>
  The following could be the probable reasons:
  a) Your are using correlated queries - Correlated
queries always re-evaluate the sub-query for each row
processed.
b) You have an IN clause - try using EXISTS clause,
since it IN clause doesn't utilize the index when your
subquery is another SELECT statement.

ludwig.



__________________________________________________
Do you Yahoo!?
New DSL Internet Access from SBC & Yahoo!
http://sbc.yahoo.com