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万行,当我尝试这样做时,我们被挂起或超时错误。索引已正确使用但被挂起了。

所以有人可以帮我解决这个问题吗

最佳答案

删除空白值后,我怀疑覆盖了
(demandID,isPend,reactivateDate)和(demandID,genericDemandId,status)会有所帮助,而不是您目前拥有的任何东西

10-08 09:35