MySQL Forums
Forum List  »  MyISAM

Re: I need Optimizaton of a Query - DISTINCT
Posted by: Rick James
Date: October 17, 2010 11:15AM

I see that u is not used in the WHERE/GROUP/ORDER clauses. So, let's postpone fetching from u and see if this will make it run faster.

SELECT
        fields from both x and u
    FROM (
        SELECT  a.created_by AS userid,
                other fields from a, c, s
            FROM a, c, s
            WHERE all where stuff
            ORDER BY ...
            LIMIT ...
         ) x
     LEFT? JOIN jos_users AS u  ON u.id = x.userid
     ORDER BY x.created DESC
     LIMIT 20;

Still desire
SHOW CREATE TABLE (for the rest of the tables)
EXPLAIN SELECT

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: I need Optimizaton of a Query - DISTINCT
1485
October 17, 2010 11:15AM


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.