MySQL Forums
Forum List  »  Optimizer & Parser

Re: Please help optimizing a long running query (left outer join, with 2 subqueries)
Posted by: Rick James
Date: January 01, 2011 07:21PM

ON p.bn = d.bn
Neither of these is indexed. That means table scans.

One approach is to get one of the subqueries indexed as you build it:
CREATE TEMPORARY TABLE p (
    bn ...,
    PRIMARY KEY (bn)
)
    SELECT  temp2.bn, max(temp2.FPE) AS max_fpe,
                temp2.`Activity Description`
            FROM  `pdata` temp2
            GROUP BY  temp2.bn ;

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: Please help optimizing a long running query (left outer join, with 2 subqueries)
1424
January 01, 2011 07:21PM


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.