MySql ORDER BY slow with join, fast as 2 queries
Investigate the plan. MySQL alters the order of the tables scanning.
Add STRAIGHT_JOIN. https://dbfiddle.uk/?rdbms=mysql_8.0&amp;fiddle=592b1fb77c5c383abb8d93f9d9e13559