View Single Post

   
  #5 (permalink)  
Old 05-05-2008, 05:51 AM
Rob Wultsch
 
Posts: n/a
Default Re: Age old order by rand() issue

On Fri, May 2, 2008 at 6:58 AM, Scott Haneda <talklists@newgeo.com> 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@newgeo.com
>


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@gmail.com
wultsch (aim)
Reply With Quote