My MySQL query is taking around 20 minutes to execute which I feel is excessive.
SELECT
hyp_id,MAX( player_count ) AS MAXPLAYERCOUNT
, MAX( viewer_count ) AS MAXVIEWERCOUNT
, SUM( player_count ) AS TOTPLAYER
, SUM( viewer_count ) AS TOTVIEWER
FROM player_count_log
WHERE
DATE(added_time) = CURDATE()
GROUP BY hyp_id
ORDER BY hyp_id
The player_count_log
table contains over 63 million records with ~18k added every hour.
Here are screenshots of db and indexes
WHERE added_time >= CAST(CURDATE() AS TIMESTAMP)
, you probably don't needAND added_time < CAST(CURDATE() + 1 AS TIMESTAMP)
as there should be no future rows.