Ok, now my table has over 340,000 rows. Picking 20 random rows now takes 14-19 seconds.
Anyone have any suggestions on how to optimize the random picking?
Edit: Here's what I have so far, and it's down to around 10 seconds:
for($a=0;$a<20;$a++) {
$rand = mt_rand(0,347812);
$sql = "SELECT word FROM words LIMIT ".$rand.",1";
$res = mysql_query($sql);
$t = mysql_fetch_row($res);
$words[$a] = $t[0];
}
I tried mysql_result, but it seems to be a couple seconds slower. Is what I have so far just the best way to do it?