Order by rand()
View Single Post
06-11-2008, 02:18 PM
Join Date: Jan 2008
Location: Maine, USA
That is why it is cpu intensive. RAND() will execute every time the WHERE clause does which will once for every record that would be returned regardless of the LIMIT.
From what I gather/understand/whatever, RAND will assign a random number to all the rows that fit the criteria and then order the results by those numbers.
The full query still needs to run even though you have the LIMIT in there, because you are ordering the results. Only the top 4 will be returned.
Why is it drug addicts and computer aficionados are both called users?
" -Clifford Stoll
View Public Profile
Send a private message to buggabill
Find More Posts by buggabill