Re: Subquery with range uses filesort
I created InnoDB versions of the tables on my development computer.
select
PlayerID, PlayerName, PlayerPrimaryClub, PlayerCountry,
HistoryEvent, HistoryDate, HistoryFinalMean, HistoryFinalStDev
from Player
join History on
HistoryPlayer = PlayerID
and HistoryEvent =
( select HistoryEvent
from History
where HistoryPlayer = PlayerID and HistoryDate <= '2012-06-30'
order by HistoryDate desc, HistoryDirector desc limit 0,1 )
where PlayerID in (...)
InnoDB
id,select_type,table,type,possible_keys,key,key_len,ref,rows,filtered,Extra
1,PRIMARY,Player,ALL,PRIMARY,NULL,NULL,NULL,51938,19.99,"Using where"
1,PRIMARY,History,eq_ref,"PRIMARY,EventReportID,PlayerDateDirector,EventInitialMean,EventFinalMean",PRIMARY,8,"func,rc_innodb.Player.PlayerID",1,100.00,"Using where"
2,"DEPENDENT SUBQUERY",History,ref,PlayerDateDirector,PlayerDateDirector,4,rc_innodb.Player.PlayerID,3,100.00,"Using where; Using index; Using filesort"
InnoDB
Development
Duration / Fetch
17.160 sec / 15.584 sec
Seems rather slow.
Subject
Views
Written By
Posted
4456
November 16, 2013 02:42PM
1555
November 17, 2013 07:42PM
1568
November 17, 2013 08:01PM
1581
November 18, 2013 04:33PM
2111
November 18, 2013 07:54PM
1794
November 19, 2013 04:10PM
1678
November 19, 2013 08:36PM
1750
November 21, 2013 02:55PM
1959
December 05, 2013 03:46PM
1587
December 07, 2013 02:10PM
1555
December 09, 2013 06:08PM
Re: Subquery with range uses filesort
1651
December 14, 2013 09:51PM
1522
December 14, 2013 10:17PM
1595
December 15, 2013 11:29PM
1687
December 17, 2013 06:58PM
1604
December 18, 2013 05:49PM
1648
December 18, 2013 08:28PM
1661
December 19, 2013 10:13PM
1636
December 19, 2013 10:28PM
1487
December 20, 2013 07:06PM
1579
December 21, 2013 07:36AM
1624
December 22, 2013 10:01AM
1686
December 22, 2013 10:45AM
1578
December 25, 2013 09:30PM