Question

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 is 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!

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top