Get the App
SLTechnology News&Howtos  ›  Development  › 

How to realize transaction isolation by Mysql

Shulou Source: shulou.com Published: 2022-06-03 09:38:35 11月15日 Update

This article mainly introduces Mysql how to achieve transaction isolation, the article is very detailed, has a certain reference value, interested friends must read it!

1. Each record will record a rollback operation when it is updated.

2. There can be multiple versions of the same record in the system, which is the multi-version concurrency control (MVCC) of the database.

3. At the level of read submitted, the latest snapshot of the current data will be obtained through MVCC.

Example

1. Select count (1) from user where age=20;-- return 0: currently there is no 2. Update user set name=test where age=20;-- Affects 10 rows of age=20: because transaction B has just written 10 age=20 records, and the write operation is not affected by MVCC, you can see the latest data, so the update is successful. Once the operation is successful, the data being operated will be visible to the current transaction. Select count (1) from user where age=20 -- return 10: there are illusions. These are all the contents of the article "how does Mysql achieve transaction isolation?" Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Tags: Transaction data isolation success content version article update value interest at the same time multiple instance guy partner that is snapshot database time more Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Information Xiaomi Docker MySQL NVidia