13、收缩表,del不回收空间,可创建临时表,大表用gh-ost 控制时间,所占资源
14、count(*)存到db或缓存中
16、select * from t where city in ('杭州'," 苏州") order by name limit 10000,100 优化:
1)归并排序,name最小前100:select * from t where city=" 杭州" order by name limit 10100;和select * from t where city="苏州 " order by name limit 10100
2)上面导致返回变大,select id,name,拿100 个id查所有记录解决
18、注意字符集、类型不同的隐式转换,导致慢sql
19、只查一行sql慢,show processlist 有锁,找到对应pid kill掉(select blocking_pid)
20、