|
-
Oct 1st, 2009, 02:08 PM
#1
Join Performance - SQL Server 2005
USING: SQL Server 2005
I'm used to seeing Joins constructed using what I'll call the "Traditional" format:
Code:
SELECT *
FROM tbl1
INNER JOIN tbl2
ON tbl1.field1 = tbl2.field1
INNER JOIN tbl3
ON tbl2.field2 = tbl2.field2
Apparently there is an "Alternative" format that allows you to nest the joins:
Code:
SELECT *
FROM tbl1
INNER JOIN tbl2
INNER JOIN tbl3
ON tbl2.field2 = tbl2.field2
ON tbl1.field1 = tbl2.field1
Besides the maintenance ick factor that I encounter when ever I see this construct... does any one know if there is a performance difference between the two?
I've got a query that is using this alternative construct, before I got in there deciphering what the joins really are, and re-arranging them to my liking, I'm curious to know if there would be any benefit to do so.
-tg
-
Oct 1st, 2009, 03:05 PM
#2
My 2 cents.
I started off with Oracle 7.3 and for me the traditional format is
SELECT * FROM TABLE1 A, TABLE2 B
WHERE A.PRIMARY_KEY = B.FOREIGN_KEY
I am still struggling to come to terms with the INNER JOIN syntax.
Everything that has a computer in will fail. Everything in your life, from a watch to a car to, you know, a radio, to an iPhone, it will fail if it has a computer in it. They should kill the people who made those things.- 'Woz'
save a blobFileStreamDataTable To Text Filemy blog
-
Oct 1st, 2009, 03:16 PM
#3
Re: Join Performance - SQL Server 2005
Yeah, I'm aware of that too... but that's not my concern... it's the nested joins (not just inner but I've got some LEFT ones that are done the same way...) I went ahead and re-arranged the query in question... no change in performance.... it would seem that my bottleneck seems to be the part of the join that has 128,000+ items on one side and 66,000+ items on the other....
-tg
-
Oct 1st, 2009, 04:10 PM
#4
Re: Join Performance - SQL Server 2005
I tried out that syntax in Oracle.
For some reason syntax #2, illustrated by you fails in Oracle 9i.
Everything that has a computer in will fail. Everything in your life, from a watch to a car to, you know, a radio, to an iPhone, it will fail if it has a computer in it. They should kill the people who made those things.- 'Woz'
save a blobFileStreamDataTable To Text Filemy blog
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|