I have a SQL UPDATE, but runtime is too long. Record count more than 400000.
UPDATE items i SET i.itemId = (SELECT o.id FROM itemOri o WHERE i.barcode = o.barcode);
Advertisement
Answer
Make sure you have indexes on the barcode
columns in both tables. Then use a JOIN
instead of a subquery:
UPDATE items i JOIN itemOri o ON i.barcode = o.barcode SET i.itemId = o.id