MySQL slowlog optimsing for Having and Group By Keywords
0
votes
2
answers
30
views
I have below entry in the slow-log, i just wonder how can i optimise this below query as it looks very simple query that, i don't see any way of optimising it,
# Query_time: 32.797535 Lock_time: 0.000000 Rows_sent: 0 Rows_examined: 512871
use dbname;
SET timestamp=1629724372;
SELECT *
FROM
screening
JOIN referrals
ON referrals
.a_id
= screening
.screen_id
JOIN referrals_file
ON referrals_file
.a_id
= referrals
.a_id
GROUP BY screening
.screen_id
HAVING (MONTH(MIN(referrals_file.datereceived)) = 12 and YEAR(MIN(referrals_file.datereceived)) = 2021);
* (please mind am not a database administrator, just developer so my knowledge will be limited)
Asked by user1179459
(143 rep)
Aug 25, 2021, 07:00 AM
Last activity: Aug 25, 2021, 11:19 PM
Last activity: Aug 25, 2021, 11:19 PM