MySQL Forums
Forum List  »  Newbie

Re: Best way to optimize SQL
Posted by: Peter Brawley
Date: April 14, 2018 08:39AM

That query simplifies to ...

select emplid, pay_end_dt`, sum(hours) as sumofhours
from x_hoursworked_base2_ds
where off_cycle = 'n' and pay_end_dt >= date_sub(curdate(), interval 1100 day)
group by emplid, pay_end_dt;

For optimisation, let's see the result of running Explain on the query, the result of Show Create Table x_hoursworked_base2_ds, and either the result of ...

show variables like 'innodb%';

or if the table isn't InnoDB then why not.



Edited 1 time(s). Last edit at 04/15/2018 01:05PM by Peter Brawley.

Options: ReplyQuote


Subject
Written By
Posted
April 13, 2018 12:36PM
Re: Best way to optimize SQL
April 14, 2018 08:39AM


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.