MySQL - Improve UPDATE Query Performance For Complex Calculations
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am trying to minimise the calculation / query time for the following UPDATE statement that is embedded in a stored procedure on my server... SET @EQUIPMENT_VARIABLE = 'B1010-V001'; UPDATE EQUIPMENT e /*24. MAX COF*/ SET e.MAX_COF = least(COF_SAFETY, COF_HEALTH, COF_ENVIRONMENT, COF_ASSETS) /*25. RECOMMENDED RBI INTERNAL INTERVAL*/ , e.RECOMMENDED_RBI_INTERNAL_INTERVAL = (SELECT RECOMMENDED_RBI_INTERNAL_INSPECTION_INTERVAL FROM DAMAGE_MECHANISM WHERE EQUIPMENT_ID = e.EQUIPMENT_ID ORDER BY RECOMMENDED_RBI_INTERNAL_INSPECTION_INTERVAL ASC