日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > 数据库 >内容正文

数据库

mysql引擎机制_关于MySQL中的InnoDB引擎的MVCC机制的理解

發布時間:2025/3/19 数据库 27 豆豆
生活随笔 收集整理的這篇文章主要介紹了 mysql引擎机制_关于MySQL中的InnoDB引擎的MVCC机制的理解 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

目前在閱讀《High Performance MysqL Second Edition》,讀到Multiversion Concurrency Control章節時對InnoDB實現MVCC的解釋總感覺有點簡單,不容易理解(當然也許是自己比較笨看不懂),所以自己總結了一點自己的理解。(查看翻譯>>>)

我摘取了本章節中個人認為比較重要的一段:

SELECT

InnoDB must examine each row to ensure that it meets two criteria:

? InnoDB must find a version of the row that is at least as old as the transac-

tion (i.e.,its version must be less than or equal to the transaction’s version).

This ensures that either the row existed before the transaction began,or the

transaction created or altered the row.

? The row’s deletion version must be undefined or greater than the transac-

tion’s version. This ensures that the row wasn’t deleted before the transac-

tion began.

Rows that pass both tests may be returned as the query’s result.

INSERT

InnoDB records the current system version number with the new row.

DELETE

InnoDB records the current system version number as the row’s deletion ID.

UPDATE

InnoDB writes a new copy of the row,using the system version number for the

new row’s version. It also writes the system version number as the old row’s

deletion version.

對于以上的內容我有一些理解是這樣(主要討論需要滿足的第二點,紅色標記):檢查發生在事務遞交時。由于插入操作如果和更新刪除發生在不同行是并發的,發生在同一行時當然不可能并發,所以不多做討論。

由于更新操作是分為插入和刪除兩部分,插入又是插入新的行(任何時候都能并發的),所以在這里可以將更新看作和刪除一樣。

用橫軸表示時間的話我們得到這樣的結果:

Update/Delete ------------------------------ 成功遞交

Update/Delete --------------------------- 失敗(因為deletion version已定義)

Update/Delete ------------------------------ 失敗(因為deletion version已定義)

Update/Delete -------- 成功遞交

deletion version應該是單獨的一個版本號。

轉自:http://www.cnblogs.com/isql/

總結

如果覺得編程之家網站內容還不錯,歡迎將編程之家網站推薦給程序員好友。

本圖文內容來源于網友網絡收集整理提供,作為學習參考使用,版權屬于原作者。

如您喜歡交流學習經驗,點擊鏈接加入交流1群:1065694478(已滿)交流2群:163560250

總結

以上是生活随笔為你收集整理的mysql引擎机制_关于MySQL中的InnoDB引擎的MVCC机制的理解的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。