Showing posts with label What is?. Show all posts
Showing posts with label What is?. Show all posts

June 3, 2012

What is deadlock?

First, what is transaction?

Transaction is a device for grouping together multiple SQL statements such that either all or none of the statements succeed (a property known as atomicity).

Database servers use locks for simultaneous access to data resources. When some portion of the database is locked, any other users wishing to modify (or possibly read) that data must wait until the lock has been released. There are several locking strategies, but this post doesn't cover it. There are also a number of different strategies that you may employ when deciding how to lock a resource (table, page or row locks).
In the next example, I'll assume that database server employs table lock. So, what is deadlock?