Does INNER JOIN performance depends on order of tables?

Posted by Kartic on Stack Overflow See other posts from Stack Overflow or by Kartic
Published on 2013-10-26T21:41:57Z Indexed on 2013/10/26 21:54 UTC
Read the original article Hit count: 207

Filed under:
|
|

A question suddenly came to my mind while I was tuning one stored procedure. Let me ask it -

I have two tables, table1 and table2. table1 contains huge data and table2 contains less data. Is there performance-wise any difference between these two queries(I am changing order of the tables)?

Query1:

SELECT t1.col1, t2.col2
FROM table1 t1
INNER JOIN table2 t2
ON t1.col1=t2.col2

Query2:

SELECT t1.col1, t2.col2
FROM table2 t2
INNER JOIN table1 t1
ON t1.col1=t2.col2

We are using Microsoft SQL server 2005.

© Stack Overflow or respective owner

Related posts about sql

Related posts about Performance