Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the MVCC of InnoDB in mysql realized?

2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly introduces "what is the realization of the MVCC of InnoDB in mysql". In the daily operation, I believe that many people have doubts about what the MVCC of InnoDB in mysql is achieved through. The editor consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful for you to answer the doubt of "what is the MVCC of InnoDB in mysql?" Next, please follow the editor to study!

1. InnoDB's MVCC is achieved by saving two hidden columns after each row of records.

These two columns, one holds the bank's transaction ID, and the other holds the bank's rollback pointer.

2. Every time you start a new transaction, a new transaction id is automatically added.

At the beginning of the transaction, the transaction id is placed in the transaction id affected by the current transaction. When querying, you need to compare the current transaction id with the transaction id for each row record.

Example

If you have a transaction that begins after update before delete and ends after delete, it looks like this:

Start transaction; / / if transaction id = 2.5select * from test; / / execution time is after update, before delete, select * from test; / / execution time is commit after delete

If you do not use the first select * from test of MVCC, you can read 1 record, while the second one will read 0 records. If the records read by multiple select range queries in the same transaction are inconsistent, it is a phantom read. After using MVVC, the two select statements read the same record.

At this point, the study of "what is the MVCC of InnoDB in mysql" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report