MySQL Forums
Forum List  »  Newbie

Best way to optimize SQL
Posted by: Matthew Fierro
Date: April 13, 2018 12:36PM

I am trying to make the following sql run faster. What is the best way to optimize? The table x_hoursworked_base2_ds has 22M rows.


SELECT ERN.EMPLID
,ERN.PAY_END_DT`
,SUM(ERN.HOURS) as SumOfHours
FROM
(SELECT
A.EMPLID
,A.PAY_END_DT
,A.HOURS
FROM x_hoursworked_base2_ds A
where A.OFF_CYCLE = 'N'
AND A.PAY_END_DT >= DATE_SUB(NOW(), INTERVAL 1100 DAY)) ERN
group by
ERN.EMPLID
,ERN.PAY_END_DT

Options: ReplyQuote


Subject
Written By
Posted
Best way to optimize SQL
April 13, 2018 12:36PM


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.