MySQL Forums
Forum List  »  Newbie

Re: Optimizing GROUP BY
Posted by: Rick James
Date: December 24, 2008 05:27PM

It IS using the index: Note in the EXPLAIN:
* key: uid_start -- it picked the right one
* key_len: 12 -- 12 =4+8; INT is 4 bytes, datetime is 8 bytes. -- Therefore, it is using both fields.
* type: range -- Well, you said start > ...; that's one flavor of "range".

Asking for exactly one uid obviates the need for uid in the GROUP BY. You should get exactly the same result with GROUP BY class.

INDEX (uid, class, start) might avoid the Using temporary, but might be slower.

Using temporary -- this is not necessarily bad. Nor does it necessarily use a disk file. It will try to do the work in a MEMORY table; if that overflows, thent will switch to MyISAM.

Options: ReplyQuote


Subject
Written By
Posted
December 23, 2008 02:11AM
December 23, 2008 11:43AM
December 23, 2008 10:45PM
December 24, 2008 02:54AM
December 24, 2008 03:05AM
December 24, 2008 05:20PM
December 24, 2008 04:13AM
Re: Optimizing GROUP BY
December 24, 2008 05:27PM
December 24, 2008 12:25PM


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.