AI engineering glossary · SQL databases
What is locking?
Locking (also called Lock): The mechanism by which a database prevents conflicting concurrent access by making transactions wait for a row, page or table to be released. Shared locks allow reading together, exclusive locks allow only one writer.
Locking: an example
SELECT ... FOR UPDATE locks the selected rows so no one else changes them until the transaction ends.
Related terms
- Deadlock
- MVCC
- Optimistic concurrency control
- Isolation level
More SQL databases terms
- Many-to-many relationship
- Materialized view
- Migration
- MVCC
- N+1 query problem
- Non-repeatable read
- Normalization
- NoSQL
Where you learn it
Locking is part of the AI Engineering Program, which teaches it with notes, a hands-on lab and an exam. The first lesson is free.