There are currently three tables
Topic topic Table ID Title
Tagsmap corresponding relationship table ID tagsid topicid
Tags tag table id tagsname
Now you need to query the first few topic records under a tag.
Select title from topic where ID in (select TopicID from Tagsmap where tagsid= "10000")
This query finds the query to be slow.
What's wrong with this notation? Ask how to optimize the query is better! I hope we can discuss it.
Reply content:
There are currently three tables
Topic topic Table ID Title
Tagsmap corresponding relationship table ID tagsid topicid
Tags tag table id tagsname
Now you need to query the first few topic records under a tag.
Select title from topic where ID in (select TopicID from Tagsmap where tagsid= "10000")
This query finds the query to be slow.
What's wrong with this notation? Ask how to optimize the query is better! I hope we can discuss it.
Just a general level of optimization:
select title from topic t left join tagsmap m on m.topicid = t.id where m.tagsid = "10000"
The amount of data in the tens of thousands of to hundreds of thousands of basically this performance is acceptable, of course, remember tagsmap inside the TAGSID plus index