0

When writing SQL queries against a large PostgreSQL database, I am seeing phantom reads despite setting the transaction isolation level to READ COMMITTED. Can you provide a concrete example of a multi-statement transaction where READ COMMITTED allows for phantom reads, and explain the precise scenario where REPEATABLE READ would be required?

1

1 Answer 1

2

The READ COMMITTED isolation level allows phantom reads — all it guarantees is that you won't get dirty reads. You can get a phantom read whenever a concurrent transaction committed a change to one of the data you previously read. Reading the data again will return the latest committed version.

Use REPEATABLE READ if you want to prevent phantom reads.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.