Pages

Monday, February 18, 2008

Lock SQL Server ...1

In order to become a good T-SQL programmer, you need to know how SQL Server manages resources to guarantee data integrity. There are several different kinds of locks SQL Server can use. Certain locks are compatible with others, for instance, the shared locks, acquired with the SELECT statement are compatible with other shared locks - multiple readers can read the data at the same time. Some other types of locks restrict the rest of the users from reading and / or modifying the data.

Locking with SQL Server represents a trade off between concurrency (and thereby, performance) and data integrity. If you are not concerned about the quality of data being read by your users, then you can allow data reads and modifications at the same time. On the other hand, if you need to have highly consistent results when reading your data, then SQL Server will allow for only one user making modifications at one time, therefore reducing the number of users simultaneously accessing data.

Keep watch out for next post on the locks...

No comments: