DBAsupport.com Forums - Powered by vBulletin
Results 1 to 4 of 4

Thread: whether to use join or subquery

  1. #1
    Join Date
    Dec 2002
    Posts
    110

    whether to use join or subquery

    Hi


    Which approach to take.
    We have certain sql queries. In first case we have used join for retrieving the results where as in the second case we use sub queries to get the same results.

    Which one of them is better , faster & more effecient.
    I have read that joins are always the slowest.

    Bye

  2. #2
    Join Date
    Feb 2000
    Location
    Washington DC
    Posts
    1,843
    Depends on volume of data, indexes, whether data is partitioned or not, init.ora parms for optimizer etc., I have 160 million row tables but data is partitioned, no issues with join queries. Its totally depends on the database and it can be tuned either way(joins/sub queries).Test the query performance in both ways and take it from there.
    Reddy,Sam

  3. #3
    Join Date
    Dec 2001
    Location
    Brazil
    Posts
    282
    Remeber that sometimes when you use a subquery, your query may be converted to join.


    F.

  4. #4
    Join Date
    Aug 2002
    Location
    Colorado Springs
    Posts
    5,253

    Re: whether to use join or subquery

    Originally posted by zulu99
    Which one of them is better , faster & more effecient.
    I would say that you are the onlly person to be able to answer that.

    i) try it on your own data
    ii) don't establish any rules of thumb
    iii) keep it as simple as possible
    iv) benchmark each query with each methodology
    v) question averything people tell you unless they can back it up with solid proof
    David Aldridge,
    "The Oracle Sponge"

    Senior Manager, Business Intelligence Development
    XM Satellite Radio
    Washington, DC

    Oracle ACE

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width