SQLAdvanced#transactions

What are transaction isolation levels?

READ UNCOMMITTED allows dirty reads; READ COMMITTED prevents them; REPEATABLE READ also prevents non-repeatable reads; SERIALIZABLE additionally prevents phantom rows. Higher isolation means more correctness and less concurrency.

Example
SET TRANSACTION ISOLATION LEVEL REPEATABLE READ;
BEGIN;
SELECT balance FROM accounts WHERE id = 1; -- same value if re-read in this txn
COMMIT;

Related Questions

1
SQLAdvanced#transactions

What is a deadlock and how do you avoid it?

Open
2
SQLAdvanced#transactions#concurrency

What are optimistic and pessimistic locking?

Open
3
SQLIntermediate#procedures

What is a stored procedure and how does it differ from a function?

Open