You asked this earlier this week.
The answer has not changed.

Matt Heaton wrote:

> Hi all, trying to do something and have it be as efficient as possilble.  My 
> question is if I have a table with say 10,000 rows in it, and I issue
> a command like this
> 
> select * from table where number=1 order by rand() limit 1;
> 
> If 1000 rows would match this command does mysql first find all 1000 rows
> and THEN randomly select 1 of those to return, OR does it just randomly
> start somewhere and then stop when it finds one?  The first method would
> be really slow and inefficient, but I am afraid that is how it works?  Is 
> there anyone out there that knows FOR SURE how the order by rand() operation 
> works?  I can't find a specification out there for it.
> 
> Thanks,
> Matt Heaton
> 
> ---------------------------------------------------------------------
> 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


-- 
Gerald L. Clark
[EMAIL PROTECTED]


---------------------------------------------------------------------
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