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 選擇正確的索引。搞定。