* roger: Try selecting FROM the cities table and JOIN with the recommendations table.
* andy SELECT count(DISTINCT user_recommending) FROM geo.cities c INNER JOIN recommendations AS t ON t.city_id = c.ID AND c.country_code = 'gm' same result. So do u think I would be better off if I save the country_code in the recommendations table as well? I did read in a sql book not to include the same data twice, but if performance is that bad?! Would you recommend to denormalize it? Andy ----- Original Message ----- From: "Roger Baklund" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Cc: "andy" <[EMAIL PROTECTED]> Sent: Monday, May 20, 2002 4:01 PM Subject: RE: Join takes way too long. Query optimizing, or denormalizing? > * andy > > > > > SELECT count(DISTINCT user_recommending) > > > > FROM recommendations t > > > > INNER JOIN geo.cities AS c ON t.city_id = c.ID AND > > > > c.country_code = 'gm' > > > I guess this is not an issue on the index. Explain select says it is using > > the index. So I assume, that I did just write down the join syntax wrong. > > MySQL is joining all 32000 records with the city table and then looks for > > the country code. So this looks ok to me. Maybe I should > > denormalize my data > > and include the country code in the other table as well? > > Try selecting FROM the cities table and JOIN with the recommendations table. > > -- > Roger > sql > --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php