Skip to content
This repository

Introducing MVCC vs Relational databases #455

Closed
codyaray opened this Issue · 0 comments

2 participants

Cody A. Ray Jan Lehnardt
Cody A. Ray

Chapter 2 introduces MVCC by describing the operation of relational databases with emphasis on locking, in particular. However, most modern relational databases actually use MVCC (Oracle, Postgres, some MySQL engines, etc).

A table in a relational database is a single data structure. If you want to modify a table—say, update a row—the database system must ensure that nobody else is trying to update that row and that nobody can read from that row while it is being updated. The common way to handle this uses what’s known as a lock. If multiple clients want to access a table, the first client gets the lock, making everybody else wait. When the first client’s request is processed, the next client is given access while everybody else waits, and so on. This serial execution of requests, even when they arrived in parallel, wastes a significant amount of your server’s processing power. Under high load, a relational database can spend more time figuring out who is allowed to do what, and in which order, than it does doing any actual work.

Instead of locks, CouchDB uses Multi-Version Concurrency Control (MVCC) to manage concurrent access to the database. Figure 2-3 illustrates the differences between MVCC and traditional locking mechanisms. MVCC means that CouchDB can run at full speed, all the time, even under high load. Requests are run in parallel, making excellent use of every last drop of processing power your server has to offer.

Wikipedia has an incomplete list of databases that use MVCC

Jan Lehnardt janl closed this in 5802ac6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.