56,677
社区成员
发帖
与我相关
我的任务
分享
上面的explain 没有去掉order,格式化不好。
这个是没有order的。
+----+-------------+-------+--------+---------------+---------+---------+----------------+--------+----------------------------------------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+-------+--------+---------------+---------+---------+----------------+--------+----------------------------------------------+
| 1 | SIMPLE | s | range | id,cid | cid | 7 | NULL | 299300 | Using where; Using temporary; Using filesort |
| 1 | SIMPLE | l | eq_ref | PRIMARY | PRIMARY | 8 | sempstats.s.id | 1 | Using where |
+----+-------------+-------+--------+---------------+---------+---------+----------------+--------+----------------------------------------------+
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY s range cid cid 7 299300 Using where
2 DEPENDENT SUBQUERY keyword_setting unique_subquery PRIMARY,cid,idx_cid_updatetime PRIMARY 8 func 1 Using where
SELECT sql_no_cache SUM(s.clicks) clicks from tba l LEFT JOIN tbb s ON s.id = l.kid where l.status <9 AND s.cid = 2776 AND s.createtime >= 1350057600 AND s.createtime <= 1351408586 GROUP BY s.id ORDER BY clicks DESC