MySQL Forums
Forum List  »  Newbie

Optimising MySQL Script
Posted by: Paul Arthur
Date: August 16, 2018 06:57AM

Hello,

I have started a new job and they are using MySQL as their main DB.

I am more use to MSSQL and was wondering if the following statement can be optimised as it's taking 10 minutes!

Thank you in advance for any help anyone can offer.

SELECT
CAST(DATE_FORMAT(created_at, '%Y-%m-%d %k:%i:00')
AS DATETIME) AS 'Date',
COUNT(*) AS Count
FROM
dbSupaLeads_log.v2_leads_request_response
WHERE
created_at BETWEEN NOW() - INTERVAL 5 HOUR AND NOW()
AND status = 'Accepted'
GROUP BY CAST(DATE_FORMAT(created_at, '%Y-%m-%d %k:%i:00')
AS DATETIME)

Options: ReplyQuote


Subject
Written By
Posted
Optimising MySQL Script
August 16, 2018 06:57AM
August 16, 2018 09:48AM
August 16, 2018 09:56AM


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.