Optimizacion de qry.. filesort con group by de timestamp field

mvelis
08 de Febrero del 2010
Hola.. estoy peleandome con un query donde necesito hacer un conteo por hora de una fecha determinada..
Necesito hacer un GROUP BY de un campo de fecha.. pero me sale en el EXPLAIN el filesort y necesito quitarselo..
ya agote todas mis posibilades.. estoy ciclada.. si me pueden ayudar.. gracias!

mvelia
08 de Febrero del 2010
anexo el query..

SELECT date(case when fid is NULL then Mdate else fdate end) as Fecha
,hour(case when fid is NULL then Mdate else fdate end)as Hr
,SUM(case when is_m = 1 then 1 else 0 end) as EngClickYes
, SUM(case when is_m = 0 then 1 else 0 end) as EngClickNo
,SUM(case when fid is not NULL and Mdidm = 1 then 1 else 0 end) as MFound
,SUM(case when fid is not NULL and Mdidm = 0 then 1 else 0 end) as MNotFound
,SUM(case when fid is NULL and is_m = 1 then 1 else 0 end) as YetToBePlayed
FROM game G
LEFT JOIN done_games ON G.gameid = fid
right JOIN matches M ON M.musrid = G.gusrid and M.medusrid = G.gamemid
where date(case when fid is NULL then M.mdate else fdate end) = date
group by hour(case when fid is NULL then M.mdate else fdate end)