Re: SQL - RANDOM

From: Date: Mon, 24 Nov 2008 23:13:54 +0000
Subject: Re: SQL - RANDOM
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-283793@lists.php.net to get a copy of this message
Korgan wrote:
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
and as your table grows in size, it gets slower and slower. Try this: http://edrackham.com/featured/get-random-row-with-mysql-without-order-by-rand/ There are other suggestions out there too, search for "mysql don't use random()". -- Postgresql & php tutorials http://www.designmagick.com/

« previous php.general (#283793) next »