Re: SQL - RANDOM

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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/


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux