首页 > mysql中这条sql语句复合索引怎么建

mysql中这条sql语句复合索引怎么建

文章的标签对应表
article_tag中就三个字段article_id、tag_id、status。

如下SQL语句的索引该怎么建最合理

select count(*) as s, article_id
  from article_tag
 where tag_id in (1, 2) and status = 1
 group by article_id
having s = 2
 order by article_id
【热门文章】
【热门文章】