I got a simple table having the following fields
Code: [Select]
Now if I got a few statistical SQL queries
Code: [Select] Code: [Select] Code: [Select]
What'd be the best way to optimize it(Indexes, etc) so that it doesn't cause heavy lags(Apart from caching)?
id int(11) primary key auto increment
wpm_total int(11)
wpm_effective int(11)
time int(11)
duration int(11)
device varchar(20)
Now if I got a few statistical SQL queries
SELECT COUNT(*) AS num, device
FROM scores
GROUP BY device
ORDER BY device_total DESC SELECT (AVG(wpp_effective) / AVG(wpp_total)) AS average
FROM scores
WHERE device = :device
GROUP BY :device SELECT AVG(wpp_effective) AS average
FROM scores
WHERE device = :device
GROUP BY :deviceWhat'd be the best way to optimize it(Indexes, etc) so that it doesn't cause heavy lags(Apart from caching)?



