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.
精彩评论