Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Record locking
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{Short description|Solution for concurrent database access}} {{Refimprove|date=December 2009}} '''Record locking''' is the technique of preventing simultaneous access to data in a [[database]], to prevent inconsistent results. The classic example is demonstrated by two [[banking|bank]] clerks attempting to update the same [[bank account]] for two different transactions. Clerks 1 and 2 both retrieve (i.e., copy) the account's [[Record (database)|record]]. Clerk 1 applies and saves a transaction. Clerk 2 applies a different transaction to his saved copy, and saves the result, based on the original record and his changes, overwriting the transaction entered by clerk 1. The record no longer reflects the first transaction, as if it had never taken place. A simple way to prevent this is to [[File locking|lock the file]] whenever a record is being modified by any user, so that no other user can save data. This prevents records from being overwritten incorrectly, but allows only one record to be processed at a time, locking out other users who need to edit records at the same time. To allow several users to edit a database table at the same time and also prevent inconsistencies created by unrestricted access, a single record can be ''locked'' when retrieved for editing or updating. Anyone attempting to retrieve the same record for editing is denied write access because of the lock (although, depending on the implementation, they may be able to view the record without editing it). Once the record is saved or edits are canceled, the lock is released. Records can never be saved so as to overwrite other changes, preserving [[data integrity]]. In database management theory, locking is used to implement ''isolation'' among multiple database users. This is the "I" in the acronym [[ACID]]. A thorough and authoritative description of locking was written by [[Jim Gray (computer scientist)|Jim Gray]].<ref>{{citation |author1 = Gray, Jim |author2 = Reuter,f |name-list-style = amp |title = Distributed Transaction Processing: Concepts and Techniques |year = 1993 |publisher = Morgan Kaufmann |pages = [https://archive.org/details/transactionproce0000gray/page/375 375β437] |ISBN = 1-55860-190-2 |url = https://archive.org/details/transactionproce0000gray/page/375 }}</ref>
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)