MySQL 性能调优之查询优化
性能调优相关文档书籍 http://dev.mysql.com/doc/refman/5.7/en/group-by-optimization.html http://dev.mysql.com/doc/refman/5.7/en/order-by-optimization.html 《MySQL性能调优与架构设计》 SQL查询优化总结 缺失索引,查询速度差别是100倍:首先应考虑在 where 及 order by 涉及的列上建立索引 1 show index from mb_ransomrequestform; 2 ALTER TABLE mb_ransomrequestform ADD INDEX IDX_corporationid (corporationid); 3 drop index IDX_corporationid on mb_ransomrequestform; View Code 避免在 where 子句使用不能使用索引的操作符,比如!=、<>、like “%xx%”、or。否则将导致引擎放弃使用索引而进行全表扫描。 1)like “%xx%”改成like “xxx%”可以使用索引 mysql> select bill.billId from EE_PawnBill bill, EE_PawnerInfo pawner where bill.pawnerid