MySQL Forums
Forum List  »  General

Re: Why are no indexes used in this case?
Posted by: Peter Brawley
Date: February 03, 2013 10:27AM

Why the love affair with IN( SELECT ... ) !? It's much slower than JOIN in many versions of MySQL.

Everything in your query except the odd HAVING clause is covered by ...

SELECT *
FROM items i
JOIN items_tags it ON i.id = it.item_id
JOIN tags t ON it.tag_id = t.id AND t.name ='flowvis'
WHERE type = 'photo';

What's the EXPLAIN result for that?

I'm not clear on the purpose of ...

GROUP BY i.id
HAVING COUNT( DISTINCT it.tag_id ) =1

Options: ReplyQuote


Subject
Written By
Posted
Re: Why are no indexes used in this case?
February 03, 2013 10:27AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.