MySQL Forums
Forum List  »  Optimizer & Parser

Re: Subquery with range uses filesort
Posted by: David Marcus
Date: November 17, 2013 08:01PM

Rick,

Thank you.

I'm not sure the "(a,b) = (c,d)" is the problem since the query below
also uses a filesort. I don't know how to turn it into a join.
Currently, I'm using a temporary table (which works OK).

explain extended select * from Player
join History on HistoryPlayer = PlayerID and
HistoryDate =
( select HistoryDate
from History
where HistoryPlayer = PlayerID and HistoryDate <= '2013-01-01'
order by HistoryDate desc, HistoryDirector desc limit 0,1 )

id,select_type,table,type,possible_keys,key,key_len,ref,rows,filtered,Extra
1,PRIMARY,History,ALL,PlayerDateDirector,NULL,NULL,NULL,880850,100.00,
1,PRIMARY,Player,eq_ref,PRIMARY,PRIMARY,4,ratingscentral.History.HistoryPlayer,1,100.00,"Using where"
2,"DEPENDENT SUBQUERY",History,ref,PlayerDateDirector,PlayerDateDirector,4,ratingscentral.Player.PlayerID,8808,100.00,"Using where; Using index; Using filesort"

Options: ReplyQuote


Subject
Views
Written By
Posted
4430
November 16, 2013 02:42PM
1548
November 17, 2013 07:42PM
Re: Subquery with range uses filesort
1561
November 17, 2013 08:01PM
1575
November 18, 2013 04:33PM
2099
November 18, 2013 07:54PM
1787
November 19, 2013 04:10PM
1672
November 19, 2013 08:36PM
1741
November 21, 2013 02:55PM
1949
December 05, 2013 03:46PM
1580
December 07, 2013 02:10PM
1549
December 09, 2013 06:08PM
1641
December 14, 2013 09:51PM
1512
December 14, 2013 10:17PM
1589
December 15, 2013 11:29PM
1677
December 17, 2013 06:58PM
1593
December 18, 2013 05:49PM
1641
December 18, 2013 08:28PM
1652
December 19, 2013 10:13PM
1630
December 19, 2013 10:28PM
1482
December 20, 2013 07:06PM
1576
December 21, 2013 07:36AM
1614
December 22, 2013 10:01AM
1674
December 22, 2013 10:45AM
1572
December 25, 2013 09:30PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.