So I have this query that is relatively fast at ~0.5 seconds but when I add an ORDER BY clause it jumps up to nearly 30 seconds.
Original query: (returns in ~0.5 seconds)
SELECT table1.*,table2.* FROM table1 LEFT OUTER JOIN table2 ON table1.column2=table2.column3 WHERE table1.column1='value' LIMIT 4
Query with ORDER BY: (returns in ~30 seconds)
SELECT table1.*,table2.* FROM table1 LEFT OUTER JOIN table2 ON table1.column2=table2.column3 WHERE table1.column1='value' ORDER BY table1.column4 DESC LIMIT 4
Note I added an index to the column that is being used by the ORDER BY and it changed nothing.
Any ideas as to what would be causing this?