SELECT timeline_id, COUNT(*) AS total FROM feed_like_2017 WHERE timeline_id IN (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) AND is_deleted = ? GROUP BY timeline_id ORDER BY total DESC
这种写法是不是很 low. 有没办法优化
本人小白
1
good758 OP 哪个大神帮我看看,谢谢
|
2
jy02201949 2017-06-13 18:05:01 +08:00
这么简单的语句还要怎么优化啊。。。
|
3
good758 OP 但是他需要 2s 查询
|
4
twm 2017-06-13 18:43:31 +08:00 via iPhone
就不能在业务环节最好统计吗?非要这么计算
|
5
littleylv 2017-06-13 18:47:17 +08:00
|
6
infun 2017-06-13 19:06:42 +08:00
IN 里面的 ID 哪里来的?
如果是查出来的,那能 join 么? |
7
good758 OP 谢谢大家
|