Statement cancelled due to timeout or client request


tomcat日志報錯:

org.springframework.dao.QueryTimeoutException:
### Error querying database. Cause: com.mysql.jdbc.exceptions.MySQLTimeoutException: Statement cancelled due to timeout or client request
### The error may exist in file [/var/lib/tomcat8/webapps/ROOT/WEB-INF/classes/mappers/DeviceMapper.xml]
### The error may involve defaultParameterMap
### The error occurred while setting parameters

原因是,MySQL優化器執行計划 使用了錯誤的索引,導致一條SQL查詢語句超時,需要30多秒,所以報錯。

解決方法是使用 force index 提示 mysql 選擇正確的索引。搞定。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM