On Feb 15, 2007, at 10:57 AM, Jochem Maas wrote:
Kevin Murphy wrote:
On my home page i have all my banners in a MySQL database which
includes
the image path, the link, and the description as separate fields. The
then do a MySQL query with a query that will look something like
this:
$query = "select * FROM banner ORDER BY RAND() LIMIT 1";
Seems to work just fine.
just wait till you have 100000 items in that table :-)
in practice that may never happen and maybe MySQL can optimize a
SELECT that does "ORDER BY RAND() LIMIT 1"
(can anyone confirm what MySQL does with "ORDER BY RAND() LIMIT 1"
exactly in terms
of scanning the table? - the MySQL docs don't mention whether this
is scalable at all)
Apparently a lot of folks think it's a bad idea on large tables...
http://www.google.com/search?client=safari&rls=en&q=ORDER+BY+RAND
();&ie=UTF-8&oe=UTF-8
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php