> For the complete documentation index, see [llms.txt](https://til.notdu.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://til.notdu.com/database/intro-to-database-systems/multi-threaded-index-concurrency-control/locks-vs.-latches.md).

# Locks vs. Latches

Locks

* Protects the database's logical contents from other txns.
* Held for txn duration
* Need to be able to rollback changes

Latches

* Protects the critical sections of the DBMS's internal data structure from other threads.
* Held for operation duration.
* Do not need to be able to rollback changes.&#x20;
