I am using the following MySQL query in a PHP script on a database that contains over 370,000,000 (yes, three hundred and seventy million) rows. I know that it is extremely resource intensive and it takes ages to run this one query. Does anyone know how I can either optimise the query or get the information in another way that's quicker?
Table Info:
games | longint, unsigned, Primary Key win | bit(1) loss | bit(1)
Query:
SELECT MID(game,{$len},1) ASmove, COUNT(*) ASgames, SUM(win) ASwins, SUM(loss) ASlossesFROMgamesWHEREgame>{$something} ANDgame<{$something_else} GROUP BYmove
Thanks in advance for your help!