Re: Select Single Random Record

Adam Berg <[email protected]>
Newsgroups gmane.comp.python.sqlobject
Message-ID <[email protected]>
Adam Berg <adamberg <at> gmail.com> writes:

> 
> Oleg Broytman <phd <at> phdru.name> writes:
> 
> > 
> > On Wed, Apr 18, 2012 at 12:30:10PM -0400, Adam Berg <adamberg <at> 
gmail.com> 
> wrote:
> > > What is the best way to select a single random record from a table and
> > > falls within the "where" criteria i have defined? I don't want to return a
> > > huge result set each time and then pick a random one
> > 
> >    Please define "random" in the context of your task. Do you want a
> > different record every time? Or some non-deterministic record that could
> > be the same every time is a possible solution?
> > 
> > Oleg.
> 
> It should be a different record each time. 
> I don't need a way to produce the same results again.
> 
> ------------------------------------------------------------------------------
> Better than sec? Nothing is better than sec when it comes to
> monitoring Big Data applications. Try Boundary one-second 
> resolution app monitoring today. Free.
> http://p.sf.net/sfu/Boundary-dev2dev

To give context to the issue, I am building my own icecast2 broadcaster. I want 
to have an Auto DJ feature which will pick a random song from the database which 
hasn't recently been played plus some other criteria. It really doesn't matter 
which record i get back from the database, I just need one at random.


------------------------------------------------------------------------------
Better than sec? Nothing is better than sec when it comes to
monitoring Big Data applications. Try Boundary one-second 
resolution app monitoring today. Free.
http://p.sf.net/sfu/Boundary-dev2dev
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.