MySQL Forums
Forum List  »  Performance

Re: Correlated subquery taking much much longer since upgrade from 5.0
Posted by: Aftab Khan
Date: July 07, 2012 08:42AM

EXPLAIN 
SELECT  a.id, 
      ( SELECT  status
            FROM  b
            WHERE     b.a_id = a.id
            ORDER BY  a_id DESC  -- change this to either a.a_id or b.a_id
            LIMIT  1) AS status
    FROM  a;

Rick,

This has already been suggested to Alan

Quoting:

" Similarly, if you specify which 'ORDER BY id' depending on what you decide a.id or b.id and check query execution plans and of course run-time. "



Edited 1 time(s). Last edit at 07/07/2012 11:02AM by Aftab Khan.

Options: ReplyQuote




Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.