whether to use join or subquery
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

    whether to use join or subquery


    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.


  2. #2
    Join Date
    Feb 2000
    Washington DC
    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.

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


  4. #4
    Join Date
    Aug 2002
    Colorado Springs

    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