Chapter 5. Getting Transactions and Locking Right
Transactions are a core technique of every professional relational database system. In fact, it is pretty hard to imagine a world without transactions these days. Atomic deletions, proper locking, and all the functionalities provided by a modern relational system are simple and expected from a modern system, and many applications rely on them. Therefore, this chapter is all about transactions and locking.
The following topics will be covered:
- The PostgreSQL transaction model
- Basic locking
FOR UPDATE
,FOR SHARE
, andNOWAIT
- Locking tables
- Understanding transaction isolation levels
- Indexes and foreign keys
- Transactions and sequences