开发者

MySQL UPDATE statement times out

开发者 https://www.devze.com 2023-01-20 11:16 出处:网络
The following very simple snippet of SQL is failing: UPDATE smalltable,bigtable SET smalltable.ssn=bigtable.ssn

The following very simple snippet of SQL is failing:

UPDATE smalltable,bigtable
SET smalltable.ssn=bigtable.ssn
WHERE smalltable.last = bigtable.last && sma开发者_运维技巧lltable.first = bigtable.first;

bigtable has 16,000 records -- not really all that big for SQL. smalltable has about 300. For some reason this statement is timing out (> 30 seconds). Why? It seems very simple, and the data isn't hard to work with: not a lot of repeats, short fields (VARCHAR(20)), etc.

Am I doing something wrong? I'm just trying to update the records in smalltable with a simple (or so I thought) lookup in bigtable.

Edit: Very possibly relevant: smalltable is a LOCAL INFILE.


Do you have indexes on:

smalltable.last, bigtable.last, smalltable.first, bigtable.first
0

精彩评论

暂无评论...
验证码 换一张
取 消