select a.uid,a.seat seat,a.id as bid,a.cid,b.customer,b.type,b.initTime,b.duration,b.record,b.ilk,
b.missedStatus,f.desc,a.acceptTime as a_acceptTime,a.bizQuality as
a_bizQuality,c.name as c_name,a.salesType as a_salesType,a.bizType as
a_bizType,a.acceptNote as a_acceptNote,c.sex as c_sex,c.customerType as
c_customerType,c.customerSource as c_customerSource,c.type as
c_type,c.callArea as c_callArea,c.zipcode as c_zipcode,c.email as
c_email,c.company as c_company,c.seat as c_seat,c.createTime as
c_createTime,c.note as c_note,c.property1 as c_property1,c.property3 as
c_property3,c.property2 as c_property2 from (select * from
phone_accept_log201307 where uid=2557 and acceptTime between 1372608000 and
1373990399 ) as a left join phone_log201307 as b on a.id = b.id left join
new_vcccallcenter.customer_info as c on a.cid=c.id left join grade_log e on
a.id = e.id left join desc_code_grade f on e.grade=f.code where c.id>0 and
c.seat='21203377' order by acceptTime desc limit 740,20;索引:
PRIMARY KEY (`id`),
KEY `cid_uid_atime` (`cid`,`uid`,`acceptTime`),
KEY `id` USING BTREE (`id`)explain:
+----+-------------+------------------------+--------+---------------+---------+---------+--------------------+------+---------------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+------------------------+--------+---------------+---------+---------+--------------------+------+---------------------+
| 1 | PRIMARY | <derived2> | system | NULL | NULL | NULL | NULL | 0 | const row not found |
| 1 | PRIMARY | e | eq_ref | PRIMARY | PRIMARY | 98 | const | 1 | |
| 1 | PRIMARY | f | eq_ref | PRIMARY | PRIMARY | 4 | new_vcclog.e.grade | 1 | |
| 1 | PRIMARY | b | eq_ref | PRIMARY | PRIMARY | 98 | const | 1 | |
| 1 | PRIMARY | c | eq_ref | PRIMARY | PRIMARY | 8 | const | 1 | Using where |
| 2 | DERIVED | phone_accept_log201307 | ALL | NULL | NULL | NULL | NULL | 4 | Using where |
+----+-------------+------------------------+--------+---------------+---------+---------+--------------------+------+---------------------+*查询很慢 2秒多 10W条数据 而且翻页的时候 越后面越慢
解决方案 »
- gcc -Wall `gtk-config—cflags—libs` *.c -o cross-window -lglade
- Waiting for table 和 locked这两个状态有什么区别?
- 我的SQL语句运行好慢,谁能给我改改,让快点
- !!!在线急等!!sqlserver中如何知道一个job的运行状态,请大侠指教,多谢!!!!!!!
- qt与mysql与arm6410串口通讯的程序中出现问题!
- mysql中怎么设置两个字段不能有重复的记录
- MySql连接字符串问题, 如何设置空用户, 空密码
- MySQL 和 PostgreSQL 是否能支持 connect by prior ... start with ...
- 请问哪有MySQL ODBC 3.51 的下载,我在老家网上下载,总是不成功。
- 提问mysql group by 的问题
- 在C语言下有没有这个API函数??求助
- 新手,求解释
有order by 和limit速度就很慢 请问下 这怎么优化
2.SELECT * 改为所查询需要的字段
3.
LEFT JOIN phone_log201307 AS b ON a.id = b.id
LEFT JOIN new_vcccallcenter.customer_info AS c ON a.cid = c.id
LEFT JOIN grade_log e ON a.id = e.id
LEFT JOIN desc_code_grade f ON e.grade = f. CODE
关联的都建索引 (外加acceptTime、seat)