mysql 强制结束查询进程,MySQL查询被绞死,不得不终止进程

UPDATE APA_Pended_Demand APD

INNER JOIN APA_Generic_Demand_Details AGD

ON APD.demandID = AGD.demandID

SET APD.genericDemandId = AGD.genericDemandId

WHERE

APD.isPend = 1

AND COALESCE(AGD.genericDemandId, '') != ''

AND APD.reactivateDate > UTC_TIMESTAMP()

AND AGD.status < 300

AND APD.ID BETWEEN 1 AND 10000

I am using the above code for update about 3,00,000 rows and when I am trying to do that we are getting hanged or timeout error.The indexes are properly used but getting hanged.

So can anyone please help me to get this sorted out

解决方案

Once you've removed the blank values, I suspect that covering indexes on

(demandID,isPend,reactivateDate) and (demandID,genericDemandId,status) will help, instead of whatever you've currently got

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值