1.The error occurred while setting parameters
The last packet successfully received from the server was 25,810 milliseconds ago. The last packet sent successfully to the server was 25,809 milliseconds ago.
报错原因:以下Sql导致
SQL: SELECT COUNT(1) FROM MCC_CONTACT_MEMBER WHERE 1=1 AND BATCH_ID = ? AND PART_ID = ?
仔细看,这个sql好像并没有什么问题,报错原因解释说是设置参数的时候报错,
但是我们仔细看以下xml中的sql代码,的确也不存在set params的时候的报错,
仔细看后面的报错,说明这个sql的执行时间超过了数据库设置的超时时间,于是我们将问题缩减到这个sql是慢sql的原因。
仔细定位发现,开发库不存在慢sql的问题,因为BatchId存在索引,
explain select* from mcc_contact_member where BATCH_ID=1 and PART_ID=1;
在开发库执行了执行计划之后,发现的确是根据索引和partId进行的单表查询。
于是,这个时候就要考虑,生产数据库是不是mcc_contact_member 的字段batchId未加BatchId索引导致的慢Sql。