Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Does JOIN order affect performance?

Status
Not open for further replies.

Hexonx

Programmer
Joined
Jan 10, 2001
Messages
102
Location
US
If I join a few tables together, some of which have few records, some with many records, does the order of the join statements affect performance? If so, what is a good strategy for determining join order?

Thanks in advance.
 
In theory, the execution plan query optimizer will find the optimum execution path regardless of the order you've specified them. And in practice, whenever I've played around with various wording when working with large tables and joins, I've not seen any difference.

But there may be some odd situation where the order does make a difference, but I've not tripped over it.

One thing to keep in mind, though, when deciding where to put your join clauses (from BOL):

the ability to specify Transact-SQL outer joins in the WHERE clause is not recommended, is no longer documented, and will be dropped in a future release. -----------------
Robert Bradley
use coupon code "TEKTIPS" for 15% off at:
 
Thanks, FoxDev. I tried a few different combinations and it made no difference. I did learn some new thngs about studying the execution plan in Query Analyzer, though.

Again, Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top