Skip to content

Read Committed

Medium — good to knowDatabase

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."

Made with passive-aggressive love by manoga.digital. Powered by Claude.