UPDATE kt_accbalance
SET accbalance_ep = CASE user_id
WHEN 10001 THEN
accbalance_ep + 8
WHEN 10002 THEN
accbalance_ep + 5
WHEN 10004 THEN
accbalance_ep + 3
WHEN 10006 THEN
accbalance_ep + 10
WHEN 10039 THEN
accbalance_ep + 100
END
WHERE
user_id IN ( 10001, 10002, 10004, 10006, 10039 )
this is a batch update of 5 items. If 2000 items are updated in batch, it means that there are 2000 user_id to be updated. 2000 of this length is scary. Can mysql handle this long? 2000 sql statements are 400 times as long as they are now. Can mysql be allowed? can sql be this long? If not, are there any other high-performance alternatives?
refer to this article: reference