MySQL Forums
Forum List  »  Newbie

Re: Group-wise Maximum performance
Posted by: Preston McMurry
Date: May 03, 2005 01:30PM

It seems to me -- and I may be wrong -- that for each record in the database, you do the subselect to see if the record is equal to whatever the max is. Thus, if you have 20,000 records in the database, you are looking at 20,000 records for each. In other words, 20,000 * 20,000 records. That would certainly slow things down. It would be better to do one query to determine the max (20,000 hits), then take that value and in a second query look for records which have that as the time (20,000 more hits) for a total of 20,000 + 20,000 (or LOTS less)

http://prestonm.com ... http://www.mcmurry.com

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.