DB locking during select, update, insert and delete
I want to understand how locking works in SQL Server (2005/2008) during select, update, insert and delete operations. Specifically, I want to know if Indexes have anything to do with locki开发者_JAVA技巧ng. I mean, having a primary key helping in locking a row rather than entire table etc., Can someone suggest some articles?
Thanks, Gopal
For SQL Server 2008, you can start with Locking and Row Versioning, and Customizing Locking for an Index.
You can control locking granularity using CREATE INDEX..., ALTER INDEX..., CREATE TABLE..., and ALTER TABLE.... See, for example, the syntax for CREATE INDEX, and search that page for the options ALLOW_ROW_LOCKS and ALLOW_PAGE_LOCKS.
精彩评论