sql如下:
select sum(num) num, unionid from subscribe where article_id = 152 and code = '0' group by unionid order by num desc limit 30
怎么建索引才能避免创建临时表和全表扫描,目前我已经创建了unionid的索引,用于另一个查询语句的。
一般对 where 子句和 group by 子句中涉及到列建索引会提高速度