Read Committed
ELI5 — The Vibe Check
Read Committed is the default isolation level in PostgreSQL. Each statement in your transaction sees the latest committed data at the time that statement runs. So if another transaction commits between your two SELECT statements, you might see different results. It's relaxed but usually good enough.
Real Talk
Read Committed is the default isolation level in PostgreSQL where each statement within a transaction sees only data committed before that statement began execution. It prevents dirty reads but allows non-repeatable reads and phantom reads. It provides the best balance of consistency and performance for most workloads.
Show Me The Code
-- Default in PostgreSQL
SET TRANSACTION ISOLATION LEVEL READ COMMITTED;
BEGIN;
SELECT balance FROM accounts WHERE id = 1; -- sees latest committed
-- Another transaction commits a change here
SELECT balance FROM accounts WHERE id = 1; -- might see different value
COMMIT;
When You'll Hear This
"Read Committed is the default for a reason, it works for 95% of cases." / "If you need stronger guarantees, step up to Repeatable Read."
Related Terms
Dirty Read
A dirty read happens when you read data from another transaction that hasn't committed yet.
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...
Serializable Isolation
Serializable isolation is the strictest mode where the database pretends all transactions run one after another, even though they're actually concurrent.
Snapshot Isolation
Snapshot isolation gives each transaction a frozen-in-time photo of the database.