As long as you get the same results from both joins, itβs important to understand that the left join is different from the inner join.
The left join will accept all rows from the left table, even if there is no match in the right table.
SQL LEFT JOIN vs SQL INNER JOIN
This way, your data is simply produced the same, given two different associations.
SELECT * FROM SomeTable ST JOIN BigTable BT ON BT.SomeID = ST.SomeID AND BT.Something = ST.Something AND BT.AnotherValue = '123'
How about this:
SELECT * FROM SomeTable INNER JOIN BigTable ON SomeTable.PreferedPrimaryKey = BigTable.PreferAForeignKey AND SomeTable.SomethingThatIsIndexedAndPreferableNumeric = BigTable.SomethingThatIsIndexedAndPreferableNumeric WHERE BigTable.AnotherValue = '123'
Check your indexes and make sure your criteria for the second part of the join is not an unindexed character string.
N. warfield
source share