Course contentsShow
← Software Engineering
Lesson 906 of 1,93328. Transactions and ConsistencyFree lesson

Read Committed Isolation

Preventing dirty reads while allowing non-repeatable reads; the default isolation level in most databases and its common use cases.

Read Committed Isolation

What you'll learn: How Read Committed isolation prevents dirty reads while still allowing data to change between reads within the same transaction.

The Core Idea

Read Committed is the default isolation level in most relational databases (PostgreSQL, Oracle, SQL Server). It guarantees that your transaction will never read data that another transaction has written but not yet committed—eliminating the "dirty read" problem from Read Uncommitted.

However, Read Committed does not lock the data you've read. If you read the same row twice in your transaction, another transaction might commit changes between those reads, giving you different results. These are called non-repeatable reads, and Read Committed allows them.

How It Works

When you execute a query under Read Committed:

  • You only see data from committed transactions
  • Each query sees a fresh snapshot of committed data at the moment it runs
  • Other transactions can modify rows between your queries

Think of it like checking a scoreboard at a sports game. Each time you look, you see the official score (committed data), but the score might change between glances because the game is still being played.

Common Use Cases

Read Committed strikes a practical balance:

  • Most OLTP applications use it as the sweet spot between consistency and concurrency
  • Banking transactions that check balances and update accounts
  • Inventory systems where occasional staleness is acceptable
  • Web applications where each request reads fresh data

It prevents the worst consistency issues (dirty reads) while maintaining good performance and allowing high concurrency—multiple transactions can read and write simultaneously without excessive locking.

Key Takeaway: Read Committed prevents dirty reads but allows non-repeatable reads, making it the pragmatic default for most database applications that need reasonable consistency without sacrificing performance.