好湿?好紧?好多水好爽自慰,久久久噜久噜久久综合,成人做爰A片免费看黄冈,机机对机机30分钟无遮挡

主頁 > 知識庫 > MySQL執行update語句和原數據相同會再次執行嗎

MySQL執行update語句和原數據相同會再次執行嗎

熱門標簽:自己做地圖標注需要些什么 福建外呼電銷機器人加盟 徐涇鎮騰訊地圖標注 中國地圖標注公司 昌德訊外呼系統 電話機器人的價格多少錢一個月 天津公司外呼系統軟件 百度地圖標注要什么軟件 400電話申請廠家現貨

背景

本文主要測試MySQL執行update語句時,針對與原數據(即未修改)相同的update語句會在MySQL內部重新執行嗎?

測試環境

  • MySQL5.7.25
  • Centos 7.4

binlog_format為ROW

參數

root@localhost : (none) 04:53:15> show variables like 'binlog_row_image';
+------------------+-------+
| Variable_name | Value |
+------------------+-------+
| binlog_row_image | FULL |
+------------------+-------+
1 row in set (0.00 sec)

root@localhost : (none) 04:53:49> show variables like 'binlog_format'; 
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| binlog_format | ROW |
+---------------+-------+
1 row in set (0.00 sec)

root@localhost : test 05:15:14> show variables like 'transaction_isolation';
+-----------------------+-----------------+
| Variable_name  | Value  |
+-----------------------+-----------------+
| transaction_isolation | REPEATABLE-READ |
+-----------------------+-----------------+
1 row in set (0.00 sec)

測試步驟

session1

root@localhost : test 04:49:48> begin;
Query OK, 0 rows affected (0.00 sec)

root@localhost : test 04:49:52> select * from test where id =1;
+----+------+------+------+
| id | sid | mid | name |
+----+------+------+------+
| 1 | 999 | 871 | NW |
+----+------+------+------+
1 row in set (0.00 sec)

root@localhost : (none) 04:54:03> show engine innodb status\Gshow master status\G
...
---
LOG
---
Log sequence number 12090390
Log flushed up to 12090390
Pages flushed up to 12090390
Last checkpoint at 12090381
0 pending log flushes, 0 pending chkp writes
33 log i/o's done, 0.00 log i/o's/second

*************************** 1. row ***************************
  File: mysql-bin.000001
  Position: 154
 Binlog_Do_DB: 
 Binlog_Ignore_DB: 
Executed_Gtid_Set: 
1 row in set (0.00 sec)

session2

root@localhost : test 04:47:45> update test set sid=55 where id =1;
Query OK, 1 row affected (0.01 sec)
Rows matched: 1 Changed: 1 Warnings: 0

root@localhost : (none) 04:54:03> show engine innodb status\Gshow master status\G
...
---
LOG
---
Log sequence number 12091486
Log flushed up to 12091486
Pages flushed up to 12091486
Last checkpoint at 12091477
0 pending log flushes, 0 pending chkp writes
39 log i/o's done, 0.00 log i/o's/second

*************************** 1. row ***************************
  File: mysql-bin.000001
  Position: 500
 Binlog_Do_DB: 
 Binlog_Ignore_DB: 
Executed_Gtid_Set: 8392d215-4928-11e9-a751-0242ac110002:1
1 row in set (0.00 sec)

session1

root@localhost : test 04:49:57> update test set sid=55 where id =1; 
Query OK, 0 rows affected (0.00 sec)
Rows matched: 1 Changed: 0 Warnings: 0

root@localhost : (none) 04:54:03> show engine innodb status\Gshow master status\G
...
---
LOG
---
Log sequence number 12091486
Log flushed up to 12091486
Pages flushed up to 12091486
Last checkpoint at 12091477
0 pending log flushes, 0 pending chkp writes
39 log i/o's done, 0.00 log i/o's/second

*************************** 1. row ***************************
  File: mysql-bin.000001
  Position: 500
 Binlog_Do_DB: 
 Binlog_Ignore_DB: 
Executed_Gtid_Set: 8392d215-4928-11e9-a751-0242ac110002:1
1 row in set (0.00 sec)

root@localhost : test 04:52:05> select * from test where id =1;
+----+------+------+------+
| id | sid | mid | name |
+----+------+------+------+
| 1 | 999 | 871 | NW |
+----+------+------+------+
1 row in set (0.00 sec)

root@localhost : test 04:52:42> commit;
Query OK, 0 rows affected (0.00 sec)

root@localhost : test 04:52:52> select * from test where id =1;
+----+------+------+------+
| id | sid | mid | name |
+----+------+------+------+
| 1 | 55 | 871 | NW |
+----+------+------+------+
1 row in set (0.00 sec)

總結

binlog_format=rowbinlog_row_image=FULL時,由于MySQL 需要在 binlog 里面記錄所有的字段,所以在讀數據的時候就會把所有數據都讀出來,那么重復數據的update不會執行。即MySQL 調用了 InnoDB 引擎提供的“修改為 (1,55)”這個接口,但是引擎發現值與原來相同,不更新,直接返回

binlog_format為STATEMENT

參數

root@localhost : (none) 04:53:15> show variables like 'binlog_row_image';
+------------------+-------+
| Variable_name | Value |
+------------------+-------+
| binlog_row_image | FULL |
+------------------+-------+
1 row in set (0.00 sec)

root@localhost : (none) 05:16:08> show variables like 'binlog_format';
+---------------+-----------+
| Variable_name | Value  |
+---------------+-----------+
| binlog_format | STATEMENT |
+---------------+-----------+
1 row in set (0.00 sec)

root@localhost : test 05:15:14> show variables like 'transaction_isolation';
+-----------------------+-----------------+
| Variable_name   | Value   |
+-----------------------+-----------------+
| transaction_isolation | REPEATABLE-READ |
+-----------------------+-----------------+
1 row in set (0.00 sec)

測試步驟

session1

root@localhost : test 05:16:42> begin;
Query OK, 0 rows affected (0.00 sec)

root@localhost : test 05:16:44> select * from test where id =1;
+----+------+------+------+
| id | sid | mid | name |
+----+------+------+------+
| 1 | 111 | 871 | NW |
+----+------+------+------+
1 row in set (0.00 sec)

root@localhost : (none) 05:16:51> show engine innodb status\Gshow master status\G
...
---
LOG
---
Log sequence number 12092582
Log flushed up to 12092582
Pages flushed up to 12092582
Last checkpoint at 12092573
0 pending log flushes, 0 pending chkp writes
45 log i/o's done, 0.00 log i/o's/second

*************************** 1. row ***************************
    File: mysql-bin.000001
   Position: 154
  Binlog_Do_DB: 
 Binlog_Ignore_DB: 
Executed_Gtid_Set: 
1 row in set (0.00 sec)

session2

root@localhost : test 05:18:30> update test set sid=999 where id =1;
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0

root@localhost : (none) 05:18:47> show engine innodb status\Gshow master status\G
...
---
LOG
---
Log sequence number 12093678
Log flushed up to 12093678
Pages flushed up to 12093678
Last checkpoint at 12093669
0 pending log flushes, 0 pending chkp writes
51 log i/o's done, 0.14 log i/o's/second

*************************** 1. row ***************************
    File: mysql-bin.000001
   Position: 438
  Binlog_Do_DB: 
 Binlog_Ignore_DB: 
Executed_Gtid_Set: 8392d215-4928-11e9-a751-0242ac110002:1
1 row in set (0.00 sec)

session1

root@localhost : test 05:16:47> update test set sid=999 where id =1;
Query OK, 0 rows affected (0.00 sec)
Rows matched: 1 Changed: 0 Warnings: 0

root@localhost : (none) 05:20:03> show engine innodb status\Gshow master status\G
...
---
LOG
---
Log sequence number 12094504
Log flushed up to 12094504
Pages flushed up to 12094504
Last checkpoint at 12094495
0 pending log flushes, 0 pending chkp writes
56 log i/o's done, 0.00 log i/o's/second

*************************** 1. row ***************************
    File: mysql-bin.000001
   Position: 438
  Binlog_Do_DB: 
 Binlog_Ignore_DB: 
Executed_Gtid_Set: 8392d215-4928-11e9-a751-0242ac110002:1
1 row in set (0.00 sec)

root@localhost : test 05:19:33> select * from test where id =1;  
+----+------+------+------+
| id | sid | mid | name |
+----+------+------+------+
| 1 | 999 | 871 | NW |
+----+------+------+------+
1 row in set (0.00 sec)

root@localhost : test 05:20:44> commit;
Query OK, 0 rows affected (0.01 sec)

root@localhost : test 05:20:57> select * from test where id =1;
+----+------+------+------+
| id | sid | mid | name |
+----+------+------+------+
| 1 | 999 | 871 | NW |
+----+------+------+------+
1 row in set (0.00 sec)

總結

在binlog_format=statement和binlog_row_image=FULL時,InnoDB內部認真執行了update語句,即“把這個值修改成 (1,999)“這個操作,該加鎖的加鎖,該更新的更新。

好了,以上就是這篇文章的全部內容了,希望本文的內容對大家的學習或者工作具有一定的參考學習價值,謝謝大家對腳本之家的支持。

您可能感興趣的文章:
  • PHP獲取MySQL執行sql語句的查詢時間方法
  • 一條SQL語句在MySQL中是如何執行的

標簽:駐馬店 荊門 黔西 昌都 梅河口 鄂爾多斯 陜西 北京

巨人網絡通訊聲明:本文標題《MySQL執行update語句和原數據相同會再次執行嗎》,本文關鍵詞  MySQL,執行,update,語句,和,;如發現本文內容存在版權問題,煩請提供相關信息告之我們,我們將及時溝通與處理。本站內容系統采集于網絡,涉及言論、版權與本站無關。
  • 相關文章
  • 下面列出與本文章《MySQL執行update語句和原數據相同會再次執行嗎》相關的同類信息!
  • 本頁收集關于MySQL執行update語句和原數據相同會再次執行嗎的相關信息資訊供網民參考!
  • 推薦文章
    主站蜘蛛池模板: 《调教.女教师》在线观看| 女鬼做爰三级在线看| 与岳的荒唐性事经历| 国产精品九九久久精品女同| 高清仑乱**| 一区二区三国产精华液| 午夜h免费福利网| 国产夜趣福利免费视频| 在医院做b超被春雨| 日本人三级| 欧美黑人暴力囗交| mm1313亚洲国产精品无码试看| 亚洲一区二区三区深夜天堂| 丰满美妇被调教性沉沦| 男人肌肌狂桶女人叽叽| 亚洲精品秘?一区二区三区在线观看| 蜜臀AV人妻国产精品系列53| 被老男人一夜做了6次爱| 校花被c的合不拢腿h文| 精品亚洲va在线va天堂资源站高清观看 | 欧美最猛黑人xxxx| 小荡货好紧好爽奶真大h视频软件| 男女无遮挡XX00动态图120 | 亚洲无人区码一码二码三码的含义| 亚洲欧洲日产国产网站| 中国美女被羞羞羞打屁股的视频| 男人狂躁进女人下面30分钟| 国产又黄不爽不遮挡视频 | 爽?好大?快?深点无码免费看| 免费的app软件下载| 91黑丝视频| 触摸slg游戏大全| 国产精品天干天干天干| 别c我了~C烂了~啊~动漫| 99久久亚洲精品日本无码| gogo人体棚拍摄影| 农民工野外一级A片免费| 国产69精品久久久久久人四虎| 人人玩人人干| 海外华人8x| 国产日韩视频|