SQL - RANDOM
| From: | Korgan | Date: | Mon, 24 Nov 2008 23:06:31 +0000 |
| Subject: | SQL - RANDOM | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-283792@lists.php.net to get a copy of this message | ||
Hi,
i would ask what is the best method for random select from database. I have table with 20k items..
- If i use ,,select * from table order by rand() limit 3", the query
took 0.0524 sec ... its slightly enough
- but if i generate rand id and then i use ,,select .... where id
in(rand1, rand2, rand3), the query took only 0.0005 sec, but
there is a problem that id doesnt exist
thanks for responses