<kbd id="afajh"><form id="afajh"></form></kbd>
<strong id="afajh"><dl id="afajh"></dl></strong>
    <del id="afajh"><form id="afajh"></form></del>
        1. <th id="afajh"><progress id="afajh"></progress></th>
          <b id="afajh"><abbr id="afajh"></abbr></b>
          <th id="afajh"><progress id="afajh"></progress></th>

          當(dāng) update 修改數(shù)據(jù)與原數(shù)據(jù)相同時(shí)會(huì)被更新嗎?

          共 808字,需瀏覽 2分鐘

           ·

          2022-07-26 00:32

          作者:powdba

          https://yq.aliyun.com/articles/694162

          一、背景

          本文主要測試MySQL執(zhí)行update語句時(shí),針對(duì)與原數(shù)據(jù)(即未修改)相同的update語句會(huì)在MySQL內(nèi)部重新執(zhí)行嗎?

          二、測試環(huán)境

          MySQL5.7.25

          Centos 7.4

          三、binlog_format為ROW

          1、參數(shù)

          2、測試步驟

          session1

          session2

          session1

          3、總結(jié)

          binlog_format=row和binlog_row_image=FULL時(shí),由于MySQL 需要在 binlog 里面記錄所有的字段,所以在讀數(shù)據(jù)的時(shí)候就會(huì)把所有數(shù)據(jù)都讀出來,那么重復(fù)數(shù)據(jù)的update不會(huì)執(zhí)行。即MySQL 調(diào)用了 InnoDB 引擎提供的“修改為 (1,55)”這個(gè)接口,但是引擎發(fā)現(xiàn)值與原來相同,不更新,直接返回。

          四、binlog_format為STATEMENT

          1、參數(shù)

          2、測試步驟

          session1

          session2

          session1

          3、總結(jié)

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

          最后給大家分享我寫的SQL兩件套:《SQL基礎(chǔ)知識(shí)第二版》《SQL高級(jí)知識(shí)第二版》的PDF電子版。里面有各個(gè)語法的解釋、大量的實(shí)例講解和批注等等,非常通俗易懂,方便大家跟著一起來實(shí)操。


          有需要的讀者可以下載學(xué)習(xí),在下面的公眾號(hào)「數(shù)據(jù)前線」(非本號(hào))后臺(tái)回復(fù)關(guān)鍵字:SQL,就行

          數(shù)據(jù)前線

          后臺(tái)回復(fù)關(guān)鍵字:1024,獲取一份精心整理的技術(shù)干貨

          后臺(tái)回復(fù)關(guān)鍵字:進(jìn)群,帶你進(jìn)入高手如云的交流群。


          推薦閱讀

          瀏覽 44
          點(diǎn)贊
          評(píng)論
          收藏
          分享

          手機(jī)掃一掃分享

          分享
          舉報(bào)
          評(píng)論
          圖片
          表情
          推薦
          點(diǎn)贊
          評(píng)論
          收藏
          分享

          手機(jī)掃一掃分享

          分享
          舉報(bào)
          <kbd id="afajh"><form id="afajh"></form></kbd>
          <strong id="afajh"><dl id="afajh"></dl></strong>
            <del id="afajh"><form id="afajh"></form></del>
                1. <th id="afajh"><progress id="afajh"></progress></th>
                  <b id="afajh"><abbr id="afajh"></abbr></b>
                  <th id="afajh"><progress id="afajh"></progress></th>
                  免费观看性欧美一级 | 热久久综合免费频99热 | 天天摸天天操 | 成人精品91 | 日皮免费视频 |