List:General Discussion« Previous MessageNext Message »
From:Dathan Pattishall Date:January 18 2005 11:34pm
Subject:RE: Doubt about Performance
View as plain text  
 




> -----Original Message-----
> From: Ronan Lucio [mailto:ronanl@stripped] 
> Sent: Tuesday, January 18, 2005 10:13 AM
> To: mysql@stripped
> Subject: Doubt about Performance
> 
> Hello,
> 
> 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.

--
DVP
> 
> Thanks,
> Ronan
> 
> 
> 
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:    
> http://lists.mysql.com/mysql?unsub=1
> 
> 
Thread
Doubt about PerformanceRonan Lucio18 Jan
  • Re: Doubt about PerformanceRonan Lucio18 Jan
  • Re: Doubt about PerformanceSasha Pachev18 Jan
  • Re: Doubt about PerformanceSGreen18 Jan
  • Re: Doubt about PerformanceRonan Lucio18 Jan
Re: Doubt about PerformanceSGreen18 Jan
  • Re: Doubt about PerformanceRonan Lucio19 Jan
RE: Doubt about PerformanceDathan Pattishall19 Jan