STRAIGHT_JOIN is a MySQL specific join operator that overrides the optimizer's default behavior of reordering tables for the lowest estimated cost. By using STRAIGHT_JOIN, you guarantee that the left table is read first, the right table second, and so on for chained joins. This can improve performance when the optimizer misjudges statistics, or when query planners change across MySQL versions. STRAIGHT_JOIN behaves like an INNER JOIN in terms of returned rows; the only difference is the enforced join sequence. Because it bypasses cost-based decisions, use it only after measuring that the forced order is faster or produces the desired execution plan. STRAIGHT_JOIN can appear between two tables or be applied globally by adding the SQL_BIG_RESULT or SQL_SMALL_RESULT options in combination with SELECT STRAIGHT_JOIN (deprecated in recent versions). In modern MySQL, writing SELECT STRAIGHT_JOIN ... is still allowed but the preferred approach is the explicit table1 STRAIGHT_JOIN table2 syntax.
MySQL 3.23
STRAIGHT_JOIN returns the same rows as INNER JOIN but enforces the written join order. INNER JOIN lets the optimizer reorder tables.
Yes. If the optimizer's chosen plan is better than the forced order, performance can drop. Test both versions before committing.
Simply replace STRAIGHT_JOIN with INNER JOIN or comma separated joins, then test the execution plan.
The table1 STRAIGHT_JOIN table2 syntax is fully supported. The older SELECT STRAIGHT_JOIN style is deprecated but still works in recent MySQL versions.