I have a query as follows:

```
SELECT DISTINCT O.MessageID, OD.Destination 
FROM OutboundMessages AS O LEFT JOIN 
     OutboundMessagesDetails AS OD 
     ON OD.MessageID=O.MessageID
WHERE O.UserID = 18097 AND
      O.Status IS NOT NULL AND
      O.Status <> 'Deleted' 
ORDER BY O.ScheduleDate DESC
LIMIT 0, 25

```

It takes around 50 seconds to complete. Here is the explain:

```
id  select_type     table   partitions  type    possible_keys           key             key_len     ref                         rows    filtered    Extra   
1   SIMPLE          O       NULL        index   PRIMARY,UserSchedule    UserSchedule    4           NULL                        15055   0.08        Using where; Using temporary
1   SIMPLE          OD      NULL        eq_ref  PRIMARY                 PRIMARY         8           NMV2_Messaging.O.MessageID  1       100.00      Using index; Distinct

```

Note that the `ORDER BY` clause is on a field in the first table (`OutboundMessages AS O`)

If I remove the `ORDER BY` or the `LEFT JOIN` it takes 0.00035 seconds to complete.

Why is there such a slow down? Presumably it's because MySQL is `LEFT JOINing` every row before doing the `ORDER BY`. If this is correct, is there a way I can prevent this and have MySQL do the `LEFT JOIN` after filtering, limiting and ordering?