← PostgreSQL learning pathPostgreSQL · Module 7 of 10
Transactions and concurrency
Keep data correct when many users act at once.
📖 Key ideas
- BEGIN; ... COMMIT; groups statements; ROLLBACK undoes.
- ACID: Atomicity, Consistency, Isolation, Durability.
- MVCC lets readers and writers not block each other.
- Isolation levels: Read Committed (default), Repeatable Read, Serializable.
- SELECT ... FOR UPDATE locks rows you will change.
💡 Real-life example: MVCC is giving every reader their own snapshot photo while writers work on the real scene.
TransactionAll-or-nothing group of statements
MVCCMulti-version concurrency control
Isolation levelHow transactions see each other
FOR UPDATELocks selected rows