Book Image

Troubleshooting PostgreSQL

Book Image

Troubleshooting PostgreSQL

Overview of this book

Table of Contents (17 chapters)
Troubleshooting PostgreSQL
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

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, and NOWAIT

  • Locking tables

  • Understanding transaction isolation levels

  • Indexes and foreign keys

  • Transactions and sequences