DEV Community

Cover image for Isolation Levels - part XI: Read Uncommitted
Franck Pachot
Franck Pachot

Posted on • Edited on

Isolation Levels - part XI: Read Uncommitted

The Read Uncommitted isolation level is designed to allow dirty reads, which are changes made by other transactions that have not yet been committed. Such changes should not be visible to other transactions. Non-MVCC databases are forced to lock the row being read to ensure that uncommitted transactions are not currently modifying them. These read locks can potentially block the application, for instance, in scenarios where a DBA is counting the rows of a large table. Non-MVCC databases had to allow such dirty reads for these operations, even if they returned inconsistent results.

With modern databases that use MVCC, you can safely ignore this isolation level. MVCC provides a consistent read time without relying on read locks. When a read encounters an uncommitted change, held with a write lock, it will just read the last committed version before the read time. The Read Committed isolation level offers the same concurrency level while avoiding the exposure of uncommitted changes. In PostgreSQL or YugabyteDB Read Committed will be used when setting Read Uncommitted. It exists for SQL compatibility, but you should never have to set it.

Top comments (2)

Collapse
 
rponte profile image
Rafael Ponte • Edited

Hi Franck,

Is this statement correct?

The Read Uncommitted isolation level is designed to prevent dirty reads [...]

I mean, Read Uncommited allows dirty read.

Collapse
 
franckpachot profile image
Franck Pachot

Yes, I'll fix it, thanks