Home  >  Article  >  Database  >  mysql大树据表update很慢解决_MySQL

mysql大树据表update很慢解决_MySQL

WBOY
WBOYOriginal
2016-06-01 13:29:331677browse

bitsCN.com

mysql大树据表update很慢解决

 

问题描述:

 

数据表千万量级,update  where gid="adadfadsfasdf",返回结果显示耗时70ms到1s之间

 

分析:

 

表很大,那么update,可能先要取索引,再取页面,但是即使都是磁盘操作,每次磁盘操作耗费5ms,大概花费20,30ms足矣

 

所以时间肯定是花在io等待上了。

 

使用 iostat   -x  -d 1   3 显示等待时间几十毫秒

 

所以时间确实花在io等待上了

 

解决方法:

 

减少io

 

增大mysql内存,原来是10G,现在搞成50G

 

bitsCN.com
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn