2015-09-22 54 views
0

我在我的数据库与内连接导致CPU使用率过高

UPDATE oc_product 
INNER JOIN mapprice on mapprice.UPC_Code = oc_product.upc 
SET oc_product.price = mapprice.MAP_Price; 

其中mapprice有大约60K的记录,包括这两个字段和oc_product具有运行查询批量更新超过25万

当我查看我得到的当前mysql进程:

等待表级锁定|

SELECT DISTINCT *,pd.name姓名,p.image,m.name AS厂商, (SELECT价格从oc_product_d |。

我的CPU使用率天空火箭

任何帮助随着使这个查询运行速度更快,将不胜感激

回答

0

我的调试方法是:

  • 检查mapprice是否有可能影响性能的触发器。
  • 确保mapprice.UPC_Codeoc_product.upc有索引。
+0

theres no triggers,and have added idexes to these columns and it it like it still still doing the same thing。我想知道如果我可以更新可以说在当时1000条记录是可能的? –