Locking, Isolation Levels, and Deadlocks
Understand DB2's locking model, the practical effect of each isolation level, and how deadlocks arise and get resolved.
DB2 locking is where relational database theory meets very concrete production pain — deadlocks, timeouts, and lock contention are recurring real-world incidents, and interviewers use this topic to check whether a candidate understands not just the vocabulary (isolation levels) but the actual behavioral tradeoffs each choice makes under concurrent load.
Isolation levels are how tightly you reserve a shared meeting room: Uncommitted Read is walking in without knocking and reading whatever's currently on the whiteboard, even mid-erase; Repeatable Read is locking the whole room for your entire meeting so nobody else can touch anything until you leave; Cursor Stability is holding the door only while you're actually looking at one specific note. A deadlock is two people each holding a door the other needs open, until security (DB2's lock manager) steps in and asks one of them to leave.