开发者

Mysql UPDATE incrementing

Is MySQL UPDATE incrementing operatio开发者_如何学Gon transaction-safe? I mean could it possible to get into the race condition while many concurrent clients execute queries like "UPDATE table SET field=field+1"? If 1000 clients will execute such query simultaneously, what value that field will be set, 1000 greater than before?


Yes. Each Update statement locks either entire table (MyISAM) or a single row (InnoDB) and other statements are queued until the lock is released.

Now, if you run each of these statements in transaction, you might actually run into a deadlock.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜