Sobes.tech
Junior — Middle

Can you explain what read type means, where a transaction cannot re-read a value already read from the database?

sobes.tech AI

Answer from AI

The type of read where a transaction cannot reread a value it has already read from the database is called "Read Uncommitted" or "Non-repeatable Read" — but more precisely, it is Non-repeatable Read.

In the context of transaction isolation:

  • Non-repeatable Read means that if a transaction reads data twice, another process may have changed that data between the reads, and the second read will return a different value.

That is, the transaction does not guarantee that a reread will return the same value as the first.

Example:

  1. Transaction A reads the value X = 10.
  2. Transaction B changes X to 20 and commits.
  3. Transaction A reads X again and gets 20, not 10.

This behavior is characteristic of isolation levels below Repeatable Read.