MySQL Forums
Forum List  »  Optimizer & Parser

Re: I need help in optimzing a order by clause in a join query
Posted by: Rick James
Date: October 10, 2013 09:34PM

How does innodb_buffer_pool_size compare to the size of both tables?

Try
SELECT  m2.*
    FROM  messages m2
    JOIN  
      ( SELECT  message_id
            FROM  messages AS m1
            JOIN subscription AS s  ON s.entity_id = m1.entity_id
            WHERE  s.user_id = 1
            ORDER BY  m1.timestamp DESC
            LIMIT  50
      ) x ON m.message_id = x.message_id; 

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: I need help in optimzing a order by clause in a join query
1255
October 10, 2013 09:34PM


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.