开发者

How does transactions (in MySQL for me) behaves when are ran concurrently?

Here is my scenario:

I have table A, that has 4 rows (id, col1, col2, col3) with a UNIQUE index put on the last 3 rows (id is primary key). Lets suppose there are 2 users: user Foo and user Bar. If both, Foo and Bar, starts a transaction in that inserts many rows on table A, and at the same time, they commit their transactions, is it possible the table to present inconsistency for UNIQUE index?

In other words, if a transaction i开发者_如何学Pythons atomic (and it is), does that mean that as long as it runs, no other transaction that can present a risk for first transaction consistency will run?

Thanks in advance!


The transactions will run concurrently (for the most part, depending on your transaction isolation level setting), but the ones that violate consistency upon commit will result in an error and have to be rolled back.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜