MySQL's InnoDB MVCC multi-version control

Source: Internet
Author: User

From MySQL High performance third edition:

We illustrate how MVCC works by InnoDB's streamlined behavior.

InnoDB's MVCC is achieved by saving two hidden columns after each row of records. These two columns, one saves the creation time of the row, and one saves the line's Expiration time (delete time). Of course, the storage is not the actual time value, but the system version number. Every start of a new thing, the system version number is automatically incremented. The system version number of the start of a thing is the version number of the thing that is used to compare the version number of the query to the row record. Let's take a look at the repeatable read isolation level, how MVCC is specifically operated.

SELECT

InnoDB will check each line of records based on 2 criteria:

A. InnoDB only finds data rows that have a version number earlier than the current system version (that is, the system version number of the line is less than or equal to the system version number of the Thing), which ensures that the line that the thing reads is either present before the thing starts, or the thing itself is inserted or modified.

B. The deleted version of the row is either undefined or larger than the current system version number. This ensures that the line that the thing reads to is not deleted before the thing starts.

INSERT

InnoDB saves the current system version number as the version number of the row for each newly inserted row.

DELETE

InnoDB saves the current system version number for each row deleted as a row delete identity.

UPDATE

InnoDB to insert a new record, save the current system version number as the line version number, while saving the current system version number as the original behavior line to delete the identity.

MVCC is really repeatable read and read commited two isolation levels work.

MySQL's InnoDB MVCC multi-version control

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.