Types of Concurrency Control
2010-03-03 22:12
176 查看
When many people attempt to modify data in a database at the same time, a system of controls must be implemented so that modifications made by one person do not adversely affect those of another person. This is called concurrency control.
Concurrency control theory has two classifications for the methods of instituting concurrency control:
Pessimistic concurrency control
A system of locks prevents users from modifying data in a way that affects other users. After a user performs an action that causes a lock to be applied, other users cannot perform actions that would conflict with the lock until the owner releases it. This is called pessimistic control because it is mainly used in environments where there is high contention for data, where the cost of protecting data with locks is less than the cost of rolling back transactions if concurrency conflicts occur.
Optimistic concurrency control
In optimistic concurrency control, users do not lock data when they read it. When a user updates data, the system checks to see if another user changed the data after it was read. If another user updated the data, an error is raised. Typically, the user receiving the error rolls back the transaction and starts over. This is called optimistic because it is mainly used in environments where there is low contention for data, and where the cost of occasionally rolling back a transaction is lower than the cost of locking data when read.
Microsoft SQL Server 2005 supports a range of concurrency control. Users specify the type of concurrency control by selecting transaction isolation levels for connections or concurrency options on cursors. These attributes can be defined using Transact-SQL statements, or through the properties and attributes of database application programming interfaces (APIs) such as ADO, ADO.NET, OLE DB, and ODBC.
--From http://msdn.microsoft.com/en-us/library/ms189132(SQL.90).aspx
Concurrency control theory has two classifications for the methods of instituting concurrency control:
Pessimistic concurrency control
A system of locks prevents users from modifying data in a way that affects other users. After a user performs an action that causes a lock to be applied, other users cannot perform actions that would conflict with the lock until the owner releases it. This is called pessimistic control because it is mainly used in environments where there is high contention for data, where the cost of protecting data with locks is less than the cost of rolling back transactions if concurrency conflicts occur.
Optimistic concurrency control
In optimistic concurrency control, users do not lock data when they read it. When a user updates data, the system checks to see if another user changed the data after it was read. If another user updated the data, an error is raised. Typically, the user receiving the error rolls back the transaction and starts over. This is called optimistic because it is mainly used in environments where there is low contention for data, and where the cost of occasionally rolling back a transaction is lower than the cost of locking data when read.
Microsoft SQL Server 2005 supports a range of concurrency control. Users specify the type of concurrency control by selecting transaction isolation levels for connections or concurrency options on cursors. These attributes can be defined using Transact-SQL statements, or through the properties and attributes of database application programming interfaces (APIs) such as ADO, ADO.NET, OLE DB, and ODBC.
--From http://msdn.microsoft.com/en-us/library/ms189132(SQL.90).aspx
相关文章推荐
- how to write your annotation types and make use of built-in annotations to control their behavior
- Overview of Form Control Types [AX 2012]
- "xxx is already under version of control"的解决办法
- Creating custom datatypes using the umbraco usercontrol wrapper
- 台湾大学林轩田机器学习基石课程学习笔记3 -- Types of Learning
- 工厂模式与控制反转(Inversion of Control)及依赖注入(Dependency Injection)
- error: invalid operands of types 'int()' and 'int' to binary 'operator%'
- ps_3_0 does not allow textures or samplers to be members of compound types
- 数值类型简介 (Overview of Numeric Types)(此文为转载)
- 3. Inversion of Control (IoC)
- Inversion of Control – An Introduction with Examples in .NET
- Change the Default View of AJAX Calendar Control
- 控制反转Inversion of Control (IoC) 与 依赖注入Dependency Injection (DI)
- 4000 IoC(Inversion of Control)的主要组件和注入方式
- checkbox in the panel control under control of one page
- IoC就是Inversion of Control,控制反转。
- windows 10 - Delphi / MCI Exclusive Control of Microphone
- svn:is not under version control and is not part of the commit, yet its child解决办法
- The content of element type "package" must match "(result-types?,interceptors?,default-interceptor-r
- A Fault Model and Mutation Testing of Access Control Policies