joins vs nested queries

Results 1 to 2 of 2

Thread: joins vs nested queries

  1. #1
    Join Date
    Dec 1969

    Default joins vs nested queries

    hi guys,<BR><BR>anybody can explain the differenec ( if exists ) between JOINs and NESTED QUERIES performance wise.<BR><BR>i made a small test in the query Analyzer two statements that return exact result, one uses JOIN and the other nested queries.<BR>the estimated execution plan was identical..but since i had only 3 records to test on!!! ....result may be deceiving..<BR><BR>anybody have an idea?<BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: joins vs nested queries

    Depends.<BR>Depends on what your selecting, and what indexes you have etc...<BR><BR>Like if you did something like this.<BR><BR>SELECT m, me, tim, T1.aa <BR>FROM mess, <BR> (SELECT COUNT(mId) AS theCount, Tow FROM mess ORDER BY tow) T1 <BR>WHERE T1.tow = mId <BR>ORDER BY tim <BR><BR>Something like that can be a bit uguly...<BR>Well, that was a bad example because there probably isnt any other option for that query...<BR><BR>All you can do is look to query analizer...<BR>If the execution plan is identicle, then there really shouldnt be much difference between the 2 of them.<BR><BR>But if plan is different then, yeah, look to see which one makes better use of PK indexes and its more likely to be a bit faster.<BR>

Posting Permissions

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