Donny Simonton wrote:
Neil,
We never delete from primary tables.  No questions asked!  We would just
mark a entry as deleted, and not select from it.

Another option you can do to solve your deletion problem is, select 35 rows
for example, when you really only want 30.  That way, you can have extras,
if say #20 is not available.

There are many options, we have even in some cases, created a table and run
the order by rand query every 5 minutes and just have it update a table.
And then we just do a select from that secondary table.  So every 5 minutes
you have new random items.

Another way is to guess a reasonably narrow fixed-width random range for a column for which you have a key, and do ORDER BY RAND() LIMIT 1 inside it. If you guess it too narrow, double it and try again until you get enough records.


The key range estimation technique is also useful in a number of other situations, eg. when paging through search results.

--
Sasha Pachev
Create online surveys at http://www.surveyz.com/

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]



Reply via email to