go-fast-sql icon indicating copy to clipboard operation
go-fast-sql copied to clipboard

Batch updates

Open rmulley opened this issue 9 years ago • 1 comments

Speed up Updates by batching them as explained at http://stackoverflow.com/questions/1006969/why-are-batch-inserts-updates-faster-how-do-batch-updates-work

UPDATE mytable
SET 
  mytext = myvalues.mytext,
  myint = myvalues.myint
FROM (
  VALUES
    (1, 'textA', 99),
    (2, 'textB', 88),
    ...
) AS myvalues (mykey, mytext, myint)
WHERE mytable.mykey = myvalues.mykey

rmulley avatar Apr 08 '15 17:04 rmulley

Another example that might be easier to implement: http://stackoverflow.com/questions/16709252/mysql-bulk-update

rmulley avatar Jul 22 '15 22:07 rmulley