Chapter 4. Understanding Transactions

Transactions are an interesting and useful feature of PostgreSQL. All sophisticated database systems offer some kind of transaction code these days.

When modifying data in a transaction-enabled database, the database uses some kind of “everything or nothing” algorithm. Imagine a DELETE statement that has to delete several thousand rows. If someone presses the reset button while the operation is running, you might run into trouble because only half of the table might have been deleted. You also might face integrity problems. To avoid such nasty occurrences, a highly sophisticated transaction-based system has been implemented in PostgreSQL.

Imagine a user starting a DELETE statement that affects millions of rows. ...

Get PostgreSQL Developer's Handbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.