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

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 >

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

發(fā)布時(shí)間:2025/3/19 23 豆豆
生活随笔 收集整理的這篇文章主要介紹了 mysql引擎机制_关于MySQL中的InnoDB引擎的MVCC机制的理解 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

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

我摘取了本章節(jié)中個(gè)人認(rèn)為比較重要的一段:

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.

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

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

用橫軸表示時(shí)間的話我們得到這樣的結(jié)果:

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

Update/Delete --------------------------- 失敗(因?yàn)閐eletion version已定義)

Update/Delete ------------------------------ 失敗(因?yàn)閐eletion version已定義)

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

deletion version應(yīng)該是單獨(dú)的一個(gè)版本號(hào)。

轉(zhuǎn)自:http://www.cnblogs.com/isql/

總結(jié)

如果覺得編程之家網(wǎng)站內(nèi)容還不錯(cuò),歡迎將編程之家網(wǎng)站推薦給程序員好友。

本圖文內(nèi)容來源于網(wǎng)友網(wǎng)絡(luò)收集整理提供,作為學(xué)習(xí)參考使用,版權(quán)屬于原作者。

如您喜歡交流學(xué)習(xí)經(jīng)驗(yàn),點(diǎn)擊鏈接加入交流1群:1065694478(已滿)交流2群:163560250

總結(jié)

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

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。