Not really, the query took 4-5 seconds. The query runs through 13910 rows
according to explain, that isnt alot is it?
SELECT COUNT(*) antal,ad.ad_id FROM ad
INNER JOIN tag_ad_map tm ON tm.ad_id=ad.ad_id
WHERE
tm.tag_id IN (99, 10807, 20728, 21, 135)
AND ad.is_removed = 0 AND ad.is_active=1 AND
One optimization I see quickly is changing the left join to an inner join.
You always look for records that exist in tag_ad_map (by checking for
tm.is_active) so the left join is not necessary. That should at least speed
this query up considerably.
Walter
Need MySQL advice?
OlinData.com is the pl