MySQL Forums
Forum List  »  General

Re: Record Position in Ordered Selection
Posted by: Rick James
Date: June 07, 2009 10:48AM

That's a common textbook way to do things, but the textbooks don't worry about performance.

FROM votes s1
JOIN votes s2 ON s1.votes < s2.votes

smacks of "Order(N*N)".
If you have N=100K, then you're talking about 10G operations. Not good performance.

I did not debug my suggestion; if it does not work, I'll help you fix it. The idea is to create a sorted list and let the AUTO_INCREMENT do create the ordering into.

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.