Locking is default behavior of SQL Server it’s not just SQL server it also applicable for any DB, this is important because to maintain accurate data it happens like explained below.
Type of locks:
SQL server puts row lock on row, key, page, extent, table and DB
Modes of locks:
Shared (S): if a transaction reading from a table and allows other transaction can come in and read the data
Update (U): if update is happening no other transaction can come in and give data to application.
Exclusive (X): updated lock can be converted as exclusive lock, but if exclusive lock happens no other lock can be taken
Intent: if update or shared lock is happening and other transaction waiting in queue then it’s called an intent lock
Schema: if there are any changes happening like delete, update in table then schema lock will happen
Bulk Update (BU):if bulk update happen then bulk update lock will happens
All of the above behaves differently according to isolation level
No comments:
Post a Comment