Wednesday, November 14, 2012

SQL Server Back to Basics with this "SQL Server: Locking basics" post

Vinod Kumar (Blog home) - SQL Server: Locking basics

"The learning journey can never stop. As we learn the basic building blocks of SQL Server there is always a need to do refreshers. This blog is on the same lines. I would urge you to read the Blog around Concurrency over at Pinal’s site and then continue the reading below because the basics of Locking is incomplete if we don’t understand what are the concurrency basics. Just like you have traffic signals that regulates traffic to make sure there are no grid locks or long waits for commuters. The parallel lanes for traffic is synonymous to concurrency. SQL Server uses locks as an mechanism to bring the consistency at the same time build the concurrency for the system. Locks are inevitable in any database world and those are also fundamental building blocks.

  1. Locks are applied in both optimistic and pessimistic concurrency models.
  2. Locking is used for maintaining consistency for concurrent transactions.
  3. Read operations acquire shared locks, exclusive locks by write operations while update locks are got during initial portion of an update operation when SQL Server is searching for the data to update.
  4. SQL Server releases locks automatically and manages compatibility between various locking modes, resolves deadlocks and lock escalations are done to reduce overheads.
  5. SQL Server controls locks on tables, on the pages of the table, on index keys and on individual rows of data based on the operation done

...

image..."

You think you know something, then you read something and realize you don't know anything (sigh... that's like the story of my life...). While I've worked with SQL Server since 4.21a, there's still stuff I learned reading this post.

1 comment:

  1. Thanks Greg for the mention and link to my post. I am glad to hear you liked it and there were some points to learn. Thanks again for linking !!!

    ReplyDelete

NOTE: Anonymous Commenting has been turned off for a while... The comment spammers are just killing me...

ALL comments are moderated. I will review every comment before it will appear on the blog.

Your comment WILL NOT APPEAR UNTIL I approve it. This may take some hours...

I reserve, and will use, the right to not approve ANY comment for ANY reason. I will not usually, but if it's off topic, spam (or even close to spam-like), inflammatory, mean, etc, etc, well... then...

Please see my comment policy for more information if you are interested.

Thanks,
Greg

PS. I am proactively moderating comments. Your comment WILL NOT APPEAR UNTIL I approve it. This may take some hours...