MySQL Forums
Forum List  »  Newbie

Re: Group-wise Maximum performance
Posted by: Felix Geerinckx
Date: May 03, 2005 02:23PM

Jon Richards wrote:

> explain SELECT data from storm s1 where
> time=(select max(s2.time) from storm s2 where
> s1.name = s2.name);
>
> with 360 updates to 20 objects with the same name
> gives:
>
> "id","select_type","table","type","possible_keys",
> "key","key_len","ref","rows","Extra"
> 1,"PRIMARY","s1","ALL","","",(null),"",6973,"Using
> where"
> 2,"DEPENDENT
> SUBQUERY","s2","ref","PRIMARY","PRIMARY",255,"stor
> m.s1.name",1,"Using index"

Definitely try a seperate index on your time column.
P.S.: why are you using a bigint for your time column?

--
felix

Options: ReplyQuote




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.