Repaso
Español
Databases & SQLAdvancedDB-04

In the SQL standard, which is the lowest isolation level that prevents non-repeatable reads?

Options

  1. Read Uncommitted
  2. Read Committed
  3. Repeatable Read (Correct option)
  4. Serializable

Answer

Repeatable Read

Why

A non-repeatable read: inside one transaction you read a row twice and get different values, because another transaction changed and committed it in between.

Levels, from weakest to strongest:

  • Read Uncommitted: can see uncommitted data (dirty reads).
  • Read Committed: no dirty reads (PostgreSQL default).
  • Repeatable Read: also no non-repeatable reads.
  • Serializable: also no phantoms (new matching rows appearing).

Remember

Read Committed < Repeatable Read < Serializable.

Key terms

Practice this question in Repaso