List:General Discussion« Previous MessageNext Message »
From:Rob Wultsch Date:May 2 2008 7:37pm
Subject:Re: Age old order by rand() issue
View as plain text  
On Fri, May 2, 2008 at 6:58 AM, Scott Haneda <talklists@stripped> wrote:
>
> > I have seen nicer fast random row implement, but that will work.
>
>
>  Do you happen to have a snip of it, the one I have seems to lean pretty
> heavy as far as I can tell, and on occasion, though rare, also sends me an
> empty result set.
>  --
>  Scott
>  talklists@stripped
>

You should not be getting empty results with the second/third query.
The reason you were (probably) previously getting empty results with
the first query was because you were doing the join using USING (aka
=) rather than >= .  You were also doing a WHERE clause on that could
have removed the random result.

My only problem with what you are using is that it is more likely to
give a large results than a small one. Take a look at the
http://jan.kneschke.de/projects/mysql/order-by-rand/

You probably do not need this.
If you have a large data set, you probably don't want this.

-- 
Rob Wultsch
wultsch@stripped
wultsch (aim)
Thread
Age old order by rand() issueScott Haneda2 May 2008
  • Re: Age old order by rand() issueRob Wultsch2 May 2008
    • Re: Age old order by rand() issueRob Wultsch2 May 2008
    • Re: Age old order by rand() issueScott Haneda2 May 2008
      • Re: Age old order by rand() issueRob Wultsch2 May 2008