1
我有臨時表和主表500萬個記錄更新表,我從臨時表使用SQL以永遠從14K記錄另一個
下面UPDATE customPricing t1
INNER JOIN customPricingIncremental t2 ON (t1.customerClass=t2.customerClass and t1.customerName=t2.customerName and t1.svcType=t2.svcType and t1.svcDuration=t2.svcDuration and t1.durationPeriod=t2.durationPeriod and t1.partNumberSKU=t2.partNumberSKU)
SET t1.customerId= t2.customerId, t1.customerNumber= t2.customerNumber, t1.custPartNumber=t2.custPartNumber, t1.sppl= t2.sppl ,t1.priceMSRP= t2.priceMSRP, t1.partnerPriceDistiDvarOEM= t2.partnerPriceDistiDvarOEM, t1.msrpSvcPrice=t2.msrpSvcPrice, t1.partnerSvcPrice=t2.partnerSvcPrice, t1.msrpBundlePrice=t2.msrpBundlePrice, t1.partnerBundlePrice=t2.partnerBundlePrice, t1.startDate=t2.startDate, t1.endDate=t2.endDate, t1.currency=t2.currency, t1.countryCode=t2.countryCode, t1.inventoryItemId=t2.inventoryItemId, t1.flexField1=t2.flexField1, t1.flexField2=t2.flexField2, t1.flexField3=t2.flexField3, t1.flexField4=t2.flexField4, t1.flexField5=t2.flexField5
CustomerClass, customerName, durationPeriod, svcDuration & partNumberSKU
更新主表中的所有的指標上都只有長度爲10的表格,兩者都沒有主鍵/唯一索引。
永遠需要更新表格,最後我會得到超時。
我做錯了什麼?
Nitesh
用鍵盤,你的意思索引,因爲我沒有爲這兩個表 – Nitesh
是定義鍵,從手動:http://dev.mysql.com/doc/refman/5.1 /en/alter-table.html「DISABLE KEYS告訴MySQL停止更新非唯一索引。」 – Baversjo
是的,我試過,但不使用!! .....我最終崩潰了MYSQL服務器 – Nitesh