Sobes.tech
Senior

How does Read Committed work inside PostgreSQL?

sobes.tech AI

Answer from AI

In PostgreSQL, the transaction isolation level Read Committed means that each individual command within a transaction sees only the data that was committed at the time that command started. If multiple queries are executed within a single transaction, each can see changes made and committed by other transactions between these queries.

That is, Read Committed prevents reading 'dirty' data (uncommitted changes), but does not guarantee data stability throughout the entire transaction — non-repeatable reads are possible.

Example:

  • Transaction A reads a row.
  • Transaction B modifies and commits that row.
  • Transaction A reads the same row again and sees the already changed data.

Thus, Read Committed is a balance between performance and consistency, suitable for most applications where full data stability within the entire transaction is not critical.