Sasha, > I assume you mean "has serious performance impact" when you say "weight". If > this is not what you meant, please correct/clarify.
Yes, youīre right. >> >> 1) Is a SELECT DISTINCT over 5,000 records a weight >> query? (Supposing it has about 20 different option the the >> DISTINCT key). > > This query will most likely result in a creation of a temporary table with 20 > columns and a key over all of them that will have no more than 5000 records, and > will take 5000 attempted inserts to populate. Assuming that your WHERE clause > is ok, this query should take no more than 3 seconds or so on modern hardware. > However, this could be bad if you are doing this frequently and there is other > activity going on. On the other hand, the query cache could save you. If it does > not, consider creating and maintaining a summary table. Hmmm, I wanted to say the SELECT DISTINCT should return about 20 lines. The table should have about a million records, but WHERE clause should filter it to up to 5,000 and such query should be in the siteīs home... :-/ Perhaps work with summaries would be a better choice. >> >> 2) Is SELECT ORDER BY RAND() over 1,500 records >> a weight query? > > Does the table have only 1,500 records, and is it going to stay that way? Are > you selecting only a few reasonably sized columns? If yes, unless you are Yahoo > or Google, you'll do fine on modern hardware - this query under those > curcumstances should take the order of maginitude of 0.01 s. However, if you > have more records in the table, and the WHERE clause is not optimized, things > could get bad, and this time the query cache does not save you. The table should have about a million records, but WHERE clause should filter it to up to 5,000 and such query should be in the siteīs home. I donīt know if it can put the site in performance troubles or if itīs paranoia of mine. Thanks, Ronan -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]