Lock (database)

Lock (database)


A lock is used when multiple users need to access a database concurrently. This prevents data from being corrupted or invalidated when multiple users try to write to the database. Any single user can only modify those database records (that is, items in the database) to which they have applied a lock that gives them exclusive access to the record until the lock is released. Locking not only provides exclusivity to writes but also prevents (or controls) reading of unfinished modifications (AKA uncommitted data).

There are two mechanisms for locking data in a database: pessimistic locking, and optimistic locking. In pessimistic locking a record or page is locked immediately when the lock is requested, while in an optimistic lock the record or page is only locked when the changes made to that record are updated. The latter situation is only appropriate when there is less chance of someone needing to access the record while it is locked; otherwise it cannot be certain that the update will succeed because the attempt to update the record will fail if another user updates the record first. With pessimistic locking it is guaranteed that the record will be updated.

The degree of locking can be controlled by isolation level Change of a lock is called lock conversion and the lock may be upgraded (lock upgrade) or downgraded (lock downgrade).

References



Wikimedia Foundation. 2010.

Игры ⚽ Поможем решить контрольную работу

Look at other dictionaries:

  • Lock — may refer to:* Lock (surname)Mechanical devices* Lock (device), a mechanical device used to secure possessions * Lock (firearm), the ignition mechanism used on early projectile weapons * Lock (water transport), an enclosure in a navigable canal… …   Wikipedia

  • Lock (computer science) — In computer science, a lock is a synchronization mechanism for enforcing limits on access to a resource in an environment where there are many threads of execution. Locks are one way of enforcing concurrency control policies. Contents 1 Types 2… …   Wikipedia

  • Lock-Keeper — is a high level security solution based on the simple Physical Separation idea. It is a hardware based device and works like a sluice to provide secure data exchange between the physically separated networks. Based on the simple principle that… …   Wikipedia

  • Lock, Stock — Lock, Stock... Lock, Stock... Titre original Lock, Stock... Genre Série tragi comique Créateur(s) Guy Ritchie Pays d’origine  Royaume Uni Chaîne d’origine …   Wikipédia en Français

  • Lock, stock — Lock, Stock... Lock, Stock... Titre original Lock, Stock... Genre Série tragi comique Créateur(s) Guy Ritchie Pays d’origine  Royaume Uni Chaîne d’origine …   Wikipédia en Français

  • Lock, stock... — Lock, Stock... Lock, Stock... Titre original Lock, Stock... Genre Série tragi comique Créateur(s) Guy Ritchie Pays d’origine  Royaume Uni Chaîne d’origine …   Wikipédia en Français

  • Lock Martin — (* 22. Februar 1916 in Pennsylvania, USA; † 19. Januar 1959 in Los Angeles County, Kalifornien, USA; eigentlich Joseph Lockard Martin junior) war ein US amerikanischer Laienschauspieler. Lock Martin hatte einen Zwillingsbruder namens Donald, der… …   Deutsch Wikipedia

  • Lock, Stock... — Lock, Stock... Titre original Lock, Stock... Genre Série tragi comique Créateur(s) Guy Ritchie Pays d’origine  Ro …   Wikipédia en Français

  • Database — A database is an organized collection of data for one or more purposes, usually in digital form. The data are typically organized to model relevant aspects of reality (for example, the availability of rooms in hotels), in a way that supports… …   Wikipedia

  • Lock Haven University of Pennsylvania — Infobox University name = Lock Haven University of Pennsylvania type = Public, state funded motto = endowment = 7.5 Million established = 1870 president = Keith T. Miller provost = Roger Johnson vp student affairs = Linda D. Koch city = Lock… …   Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”