2.索引优化分析
性能下降SQL慢 、执行时间长 、 等待时间长 常见原因: 1.查询语句写的烂 2.索引失效 #id name email weixinNumber select *from user where name=""; select *from user where name="" and email=""; create index idx_user_name on user(name);#单值 create index idx_user_nameEmail on user(name,email);#复合 2.关联查询太多join(设计缺陷或不得已的需求) 3.服务器调优及各个参数设置(缓冲\线程数等) sql 执行顺序 #手写sql的顺序 7 select 8 distinct <select_list> 1 from <left_table> 3 <join_type> join <right_table> 2 on <join_condition> 4 where <where_condition> 5 group by <groupby_list> 6 having <having_condition> 9 order by <orderby_conditoin> 10 limit <limit number>; #机读 1. FROM <left_table> 2. ON