本文介绍了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
我正在使用上面的代码来更新约300万行,当我尝试这样做时,我们会被挂起或超时错误.索引已正确使用但被挂起了.
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
推荐答案
删除空白值后,我怀疑覆盖了(demandID,isPend,reactivateDate)和(demandID,genericDemandId,status)会有所帮助,而不是您目前拥有的
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
这篇关于MySQL查询被绞死,不得不终止进程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!