> -----Original Message-----
> From: Ronan Lucio [mailto:ronanl@stripped]
> Sent: Tuesday, January 18, 2005 10:13 AM
> To: mysql@stripped
> Subject: Doubt about Performance
> Trying to keep the database and the application fast, I´d
> like to clearify my mind about it.
> 1) Is a SELECT DISTINCT over 5,000 records a weight
> query? (Supposing it has about 20 different option the the
> DISTINCT key).
This is not bad, it's a mysql function that uses a KEY if a key exist.
> 2) Is SELECT ORDER BY RAND() over 1,500 records
> a weight query?
> I need to put these two queries in the first page of our site.
> So, I´ve been worried if it can slow down our site in the pics.
DO SELECT ORDER BY RAND() LIMIT <<< 1500
Such that <<< means much less then 1500 on the order of 10.
This is a rather expensive operation and should be used with care.
I've gotten around this by generating a random number in my app and trying to match it to
a known id by making multiple selects. This was less intensive then ORDER BY RAND.
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe: