This tutorial shows you how to write straight joins in MySQL and when an it makes sense to do so. Included are a general description, syntax examples and a comparison of straight and inner joins..
A STRAIGHT_JOIN identifies and combines matching rows which are stored in two related tables. This is what an inner join also does. The difference between an inner join and a straight join is that a straight join forces MySQL to read the left table first.
To see if the STRAIGHT_JOIN hint would make sense, you have to use EXPLAIN to analyze your queries. When you feel that another join order could improve the performance, use[Read more...]