1. <ul id="0c1fb"></ul>

      <noscript id="0c1fb"><video id="0c1fb"></video></noscript>
      <noscript id="0c1fb"><listing id="0c1fb"><thead id="0c1fb"></thead></listing></noscript>

      99热在线精品一区二区三区_国产伦精品一区二区三区女破破_亚洲一区二区三区无码_精品国产欧美日韩另类一区

      RELATEED CONSULTING
      相關(guān)咨詢
      選擇下列產(chǎn)品馬上在線溝通
      服務(wù)時(shí)間:8:30-17:00
      你可能遇到了下面的問題
      關(guān)閉右側(cè)工具欄

      新聞中心

      這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
      MySQLmvcc奇怪的現(xiàn)象分析

      這篇文章主要講解了“MySQL mvcc奇怪的現(xiàn)象分析”,文中的講解內(nèi)容簡單清晰,易于學(xué)習(xí)與理解,下面請大家跟著小編的思路慢慢深入,一起來研究和學(xué)習(xí)“MySQL mvcc奇怪的現(xiàn)象分析”吧!

      創(chuàng)新互聯(lián)主營神農(nóng)架林區(qū)網(wǎng)站建設(shè)的網(wǎng)絡(luò)公司,主營網(wǎng)站建設(shè)方案,重慶APP開發(fā)公司,神農(nóng)架林區(qū)h5小程序定制開發(fā)搭建,神農(nóng)架林區(qū)網(wǎng)站營銷推廣歡迎神農(nóng)架林區(qū)等地區(qū)企業(yè)咨詢

      奇怪的現(xiàn)象1:

      session1:

      root@localhost : test 08:43:09> select * from test1;(1)
      +---------+------+
      | orderid | ID   |
      +---------+------+
      |       2 | 123  |
      +---------+------+
      1 row in set (0.00 sec)

      root@localhost : test 08:43:14> start transaction;(2)
      Query OK, 0 rows affected (0.00 sec)

      root@localhost : test 08:43:23> select * from test1;(3)
      +---------+------+
      | orderid | ID   |
      +---------+------+
      |       2 | 123  |
      +---------+------+
      1 row in set (0.00 sec)

      root@localhost : test 08:43:27> select * from test1;(5)
      +---------+------+
      | orderid | ID   |
      +---------+------+
      |       2 | 123  |
      +---------+------+
      1 row in set (0.00 sec)

      root@localhost : test 08:44:03> update test1 set id=234 where orderid=1;(6)
      Query OK, 1 row affected (0.01 sec)
      Rows matched: 1  Changed: 1  Warnings: 0

      root@localhost : test 08:44:27> select * from test1;(7)
      +---------+------+
      | orderid | ID   |
      +---------+------+
      |       1 | 234  |
      |       2 | 123  |
      +---------+------+
      2 rows in set (0.00 sec)

      session2:

      root@localhost : test 08:43:48> INSERT into test1 values(1,123);(4)
      Query OK, 1 row affected (0.01 sec)

      奇怪的現(xiàn)象2:

      session1:

      root@localhost : test 08:46:57> select * from test1;(1)
      +---------+------+
      | orderid | ID   |
      +---------+------+
      |       1 | 123  |
      |       2 | 123  |
      +---------+------+
      2 rows in set (0.00 sec)

      root@localhost : test 08:47:01> start transaction;(2)
      Query OK, 0 rows affected (0.00 sec)

      root@localhost : test 08:47:15> select * from test1;(4)
      +---------+------+
      | orderid | ID   |
      +---------+------+
      |       1 | 123  |
      |       2 | 123  |
      |       3 | 123  |
      +---------+------+
      3 rows in set (0.00 sec)

      session2:

      insert into test1  values(3,'123');(3)

      現(xiàn)象3:

      root@localhost : test 08:49:26> start transaction;(1)
      Query OK, 0 rows affected (0.00 sec)

      root@localhost : test 08:49:28> select * from test1;(2)
      +---------+------+
      | orderid | ID   |
      +---------+------+
      |       1 | 123  |
      |       2 | 123  |
      |       3 | 123  |
      +---------+------+
      3 rows in set (0.00 sec)

      root@localhost : test 08:49:30> select * from test1;(4)
      +---------+------+
      | orderid | ID   |
      +---------+------+
      |       1 | 123  |
      |       2 | 123  |
      |       3 | 123  |
      +---------+------+
      3 rows in set (0.00 sec)

      session2:
      root@localhost : test 08:47:43> insert into test1  values(4,'123');(3)
      Query OK, 1 row affected (0.01 sec)

      現(xiàn)象2和現(xiàn)象3中可以用mvcc中的read-view完美解釋:

      1、 看不到read view創(chuàng)建時(shí)刻以后啟動(dòng)的事務(wù)
      2、 看不到read view創(chuàng)建時(shí)活躍的事務(wù)

      可能我們熟知的在repeatable-read的隔離級別下,是當(dāng)一個(gè)會(huì)話發(fā)起dml語句后,在當(dāng)前會(huì)話中如果沒有提交當(dāng)前會(huì)話是看不到dml語句操作的結(jié)果的!read-view的應(yīng)用可能很少注意到,像我就是這樣。

      但是現(xiàn)象1怎么解釋呢?

      會(huì)話1中的insert  trx_id=aa 會(huì)話2 中的 trx_id=ac,session2中update之后trx_id=ab ,下面可以看得更清楚

      也就是在會(huì)話一中update 會(huì)話2上的不可見的更新時(shí) 會(huì)將會(huì)話2中的trx_id變?yōu)闀?huì)話1相同的trx_id 所以會(huì)話1這個(gè)時(shí)候能看到的會(huì)話2 中不可見數(shù)據(jù)的更新之后的狀態(tài)。

      感謝各位的閱讀,以上就是“MySQL mvcc奇怪的現(xiàn)象分析”的內(nèi)容了,經(jīng)過本文的學(xué)習(xí)后,相信大家對MySQL mvcc奇怪的現(xiàn)象分析這一問題有了更深刻的體會(huì),具體使用情況還需要大家實(shí)踐驗(yàn)證。這里是創(chuàng)新互聯(lián),小編將為大家推送更多相關(guān)知識(shí)點(diǎn)的文章,歡迎關(guān)注!


      文章題目:MySQLmvcc奇怪的現(xiàn)象分析
      網(wǎng)站網(wǎng)址:http://www.ef60e0e.cn/article/pjscgs.html
      99热在线精品一区二区三区_国产伦精品一区二区三区女破破_亚洲一区二区三区无码_精品国产欧美日韩另类一区
      1. <ul id="0c1fb"></ul>

        <noscript id="0c1fb"><video id="0c1fb"></video></noscript>
        <noscript id="0c1fb"><listing id="0c1fb"><thead id="0c1fb"></thead></listing></noscript>

        德州市| 潮州市| 富民县| 宁德市| 巴南区| 奉贤区| 新野县| 崇义县| 连州市| 讷河市| 安塞县| 文水县| 泽库县| 资阳市| 定陶县| 唐山市| 米易县| 达日县| 怀来县| 南部县| 佳木斯市| 博罗县| 古蔺县| 邓州市| 乌兰察布市| 红河县| 宜春市| 蓬安县| 乌什县| 含山县| 松阳县| 兴化市| 黑河市| 榆中县| 瑞金市| 明溪县| 淮南市| 辽阳市| 宁阳县| 高雄市| 佛坪县|