Dirty Read
ELI5 — The Vibe Check
A dirty read happens when you read data from another transaction that hasn't committed yet. Imagine reading someone's draft email before they hit send, then they delete it. You saw something that never officially existed. PostgreSQL doesn't even allow this because it's too chaotic.
Real Talk
A dirty read occurs when a transaction reads data written by another uncommitted transaction. If that transaction rolls back, the first transaction has read data that never existed. The READ UNCOMMITTED isolation level permits dirty reads, but PostgreSQL's lowest level (READ COMMITTED) already prevents them. It's primarily a concern in MySQL and SQL Server.
When You'll Hear This
"PostgreSQL doesn't allow dirty reads even at its lowest isolation level." / "Dirty reads can cause phantom bugs that are nearly impossible to reproduce."
Related Terms
MVCC
MVCC (Multi-Version Concurrency Control) is how databases let multiple users read and write at the same time without stepping on each other's toes.
Phantom Read
A phantom read is when you run the same query twice in a transaction and get different rows back because another transaction inserted or deleted matching r...
Read Committed
Read Committed is the default isolation level in PostgreSQL.
Snapshot Isolation
Snapshot isolation gives each transaction a frozen-in-time photo of the database.