Re: Banner rotation with links

From: Date: Thu, 15 Feb 2007 18:37:54 +0000
Subject: Re: Banner rotation with links
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-248920@lists.php.net to get a copy of this message
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

« previous php.general (#248920) next »