>>>>> "Vivek" == Vivek Khera <khera@stripped> writes:
Vivek> I have an application where I need to select certain random values
Vivek> from a select set. The obvious way to do it is via cursors. That is,
Vivek> I perform the select, generate the random numbers, then seek the
Vivek> cursor that position in the set to retrieve the row. The data set is
Vivek> *way* big and will not fit into memory, so that's not a viable option.
Vivek> Right now, I'm doing a COUNT() on the dataset, then performing
Vivek> repetitive "SELECT ... LIMIT N,1" where N is my random number.
Vivek> Needless to say, this is very inefficient!
Vivek> Is there some good way to emulate the cursor functionality from the
Vivek> Perl DBI interface?
In MySQL 3.23.2 you can do:
SELECT * from table order by rand();
Regards,
Monty