卡,就一个字字字字

网站卡慢问题解决

服务器卡了,报警了,怎么办? 

装个xhprof,看看哪里卡了

网站卡慢问题解决

点 profile查看详情:

网站卡慢问题解决


点[View Full callGraph]查看图:

网站卡慢问题解决

放大点:

网站卡慢问题解决

红的是特别慢的地方,这个sql语句就用了1.2秒

网站卡慢问题解决

想办法优化:

找到sql语句,然后explain

网站卡慢问题解决

网站卡慢问题解决

发现3个表关联的字段都没建索引,那就建索引咯:

ALTER TABLE `table_name` ADD INDEX index_name ( `column1`, `column2`, `column3` )

建好索引之后查询速度降到0.03秒


相关文章:

  • 2021-08-10
  • 2022-12-23
  • 2021-07-18
  • 2021-10-20
  • 2021-12-12
  • 2021-07-02
  • 2021-06-13
猜你喜欢
  • 2022-02-18
  • 2021-07-26
  • 2022-01-19
  • 2021-05-20
  • 2021-10-18
  • 2021-05-26
  • 2021-08-18
相关资源
相似解决方案