speeding up a query on MySql
Here's what I'd do:


Use EXPLAIN on your SELECT to reveal which indexes it's using. 
Tune your query and repeat step 1 until satisfied. 
Create your new table with the desired structure.
Use INSERT ... INTO new table SELECT FROM ... old table replacing the select part with the SELECT query you tuned in step 2.