A Serious Problem to Avoid: Deadlocks

Imagine that your database application has two users: Paul and Mary.

Paul starts a transaction and modifies some attributes of the Acme Ltd. customer. Later, inside the same transaction, Paul tries to modify this customer's payments. However, Paul cannot modify these payments because Mary holds an exclusive lock on these payment records. Paul must wait for these records to be unlocked before completing the transaction.

Mary is modifying customers' payments, and that's why this information is locked. Inside the same transaction, Mary tries to modify some data about the Acme Ltd. customer. At this moment, Paul, who modified this record just a few minutes ago, locks this information.

Mary cannot update this ...

Get Microsoft® SQL Server™ 2000 Programming by Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.