I have a db table filled with about ~30k records.I want to randomly select a record one at a time (when demanded by users), delete the record from the table, and insert it in another table.I've heard/found that doing \[code\]ORDER BY RAND()\[/code\] can be quite slow. So I'm using this algorithm (pseudo code):\[code\]lowest = getLowestId(); //get lowest primary key id from tablehighest = getHighestId(); //get highest primary key id from tabledo{ id = rand(lowest, highest); //get random number between a range of lowest id and highest id idExists = checkIfRandomIdExists( id );}while (! idExists);row = getRow (id);process(row);delete(id);\[/code\]Right now, with 30k records, I seem to get random ids very quickly. However as the table size decreases to 15k, 10k, 5k, 100, etc, (can be months) I'm concerned that this might begin to get slower.Can I do anything to make this method more effective, or is there a row count at which point I should start doing \[code\]ORDER BY RAND()\[/code\] instead of this method? (e.g when 5k rows are left, start doing ORDER BY RAND() ?)