18 Apr 2012 18:30
Select Single Random Record
Adam Berg <adamberg <at> gmail.com>
2012-04-18 16:30:10 GMT
2012-04-18 16:30:10 GMT
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, as the database is located outside of my network and accessed over the internet.
--
Adam Berg
------------------------------------------------------------------------------ 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
_______________________________________________ sqlobject-discuss mailing list sqlobject-discuss <at> lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss

I have had some difficulties with slow operations due
to multiple queries, and it feels more satisfactory get
rid of any avoidable query, even if the saving is only
a fraction of a percent of the total running time.
> How many records (IDs) do you expect to be returned using the first select?
thousands in current tests;
hundreds of thousands is likely in future tests,
and millions is plausible.
> How many kb will it take? Is the list size a real problem for your Internet
> connection?
Might be; especially when it is over the Internet as opposed to
over a LAN. Yet, I am as concerned with query processing time than
transmission time.
> How often do you expect to release the select querry?
Could vary. About 50 clients querying once a minute each
may be typical, but I am sure I will see faster jobs completing
in seconds, in which case each client would query correspondingly
often.
> 2)
> what is your target database engine?
postgres at the moment.
> some databases allow "rand" in the select query.
> see:
> 
RSS Feed