I need help with understanding resultant behaviour of concurrent transactions updating same row of the database.
Database : MySQL
Scenario:
1) Transaction A will update row (1,2,3)
2) Transaction B will update row (1,3,4)
Since both transactions are executing in parallel, in auto-commit mode turned off, would the final state (for row 1 and 3) will reflect the changes made by both A and B or there is a potential for data loss.
Also would the answer change if the transactions are simply incrementing the data records?
If both transactions update the same row, the second transaction will be blocked until the first transaction is either rolled back or committed. In other words the transactions will not run in parallel at the end.
This actually depends on isolation level, see for example http://developer.mimer.com/documentation/latest_jdbcguide_html/programming.html for details.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With