I am trying to optimize my mysql queries to avoid \'using temporary, using filesort\'. I could use some help. First; here is the explain
Here is the Query
That's the most efficient way to write that query.
Make sure that pf.friend_id, pf.member_id, and m.id have indices on them. Then it will use the indices to join the tables and filter the results.
pf.friend_id
pf.member_id
m.id
That sort is going to come up, anyway, because of your order by.
order by