Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Does order of tables in JOINS affect performance?

Author  Topic 

spitfire122
Starting Member

11 Posts

Posted - 2012-03-27 : 16:32:33
I have a large view I created... and it has about 15 left joins ... I read that the order of these joins matters in performance. the table name specified last will be processed first, so you always want the table with the least amount of records first.

am i correct? I have manipluated the order of my joins in tables and have noticed a run time decrease, I guess i'm wondering is what else is involved in improving performance with join order?

GilaMonster
Master Smack Fu Yak Hacker

4507 Posts

Posted - 2012-03-27 : 16:34:01
Join order does not influence performance. The optimiser does not care what order you specify the tables in.

--
Gail Shaw
SQL Server MVP
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2012-03-27 : 16:35:52
SQL Server will rearrange the order of joins at it sees fit. It's all about cost and statistics.



N 56°04'39.26"
E 12°55'05.63"
Go to Top of Page

spitfire122
Starting Member

11 Posts

Posted - 2012-03-27 : 16:47:22
anyone have a website that has good tips on how to write efficient SQL queries? tips, etc..
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2012-03-27 : 16:52:44
You're LOOKING at it

Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx


Want to help yourself?

http://msdn.microsoft.com/en-us/library/ms130214.aspx

http://weblogs.sqlteam.com/brettk/

http://brettkaiser.blogspot.com/


Go to Top of Page

GilaMonster
Master Smack Fu Yak Hacker

4507 Posts

Posted - 2012-03-27 : 17:29:50
You;ll find lots of bits and pieces in various places, forum posts, articles, blogs, etc. I don't think there's one place with everything

--
Gail Shaw
SQL Server MVP
Go to Top of Page
   

- Advertisement -