MySQL sum query taking huge time to complete. Looking for a bottleneck
try making an index to userId like this will solve your problem:
ALTER TABLE game_attempts ADD INDEX (userId);
It suggests you are returning a large number of rows to the client.Can you add
GROUP BY userId
to make sure you return just a single row?
Make an index on userId. That restricts access to records with failing userId.