I can't seem to find a specificatoin on order by rand() and have a question.

Lets say a table has 10,000 rows in it, and I want to get one row that
matches

so I do a

select * from table where number=1 order by rand() limit 1;


What if 100 rows match?  Does it first get all 100 rows and then randomly
choose one?
Or does it find the first one and stop?  If it finds 100 rows and then
chooses one this
is VERY inefficient.  If it finds one and then stops, what determines which
row it starts
searching on?

If anyone knows FOR SURE how this works please let me know... I need to be
able to grab
a single row FAST even if a bunch of rows match.  Let me know if you have
any ideas.

Thanks,
Matt


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to