Junior — Middle
What level of transaction isolation prevents simultaneous overwriting of results during parallel updates?
sobes.tech AI
Answer from AI
The transaction isolation level that prevents concurrent overwriting of results during parallel updates is called Repeatable Read or Serializable.
- Repeatable Read guarantees that if a transaction reads data, subsequent reads within the same transaction will see the same data, preventing unintentional overwriting.
- Serializable is the strictest level, providing full transaction isolation, eliminating all anomalies, including phantom reads and overwrites.
In most DBMSs, the Repeatable Read level is sufficient to prevent the "lost update" problem, but Serializable is used for maximum protection.
Example in Java using JDBC:
connection.setTransactionIsolation(Connection.TRANSACTION_REPEATABLE_READ);