when dealing with large datasets where Table A has considerably very less no of rows when compared to B. Is there any difference between joining Table A with B and B with A in the query below
SELECT A.col_PK , B.col_PK FROM A INNER JOIN B ON A.col_PK = A.col_PK WHERE A.col_2 = "0001";
This is a bit long for a comment.
For an INNER JOIN
, there is no difference in functionality (order does make a difference for outer joins). For performance, the optimizer generally chooses the best ordering.
Under some circumstances, when your query has long sequences of joins, the optimizer may not be able to consider all options. In those cases, the ordering could make a difference to the performance.