Example verification MySQL | update field with the same value will record binlog

Example verification MySQL | update field with the same value will record binlog

1. Introduction

A few days ago, a development colleague asked me whether updating a field to the same value would record binlog. I replied that it would not.

Strictly speaking, this answer is inaccurate, as it is necessary to distinguish between scenarios. Whether to record update statements in binlog depends on the setting of binlog_format. Practice makes perfect in specific situations.

Second test

2.1 binlog_format is ROW mode

2.2 binlog_format is in STATEMENT mode

Parse the binlog content and record the update statement completely.

2.2 binlog_format is in MIXED mode

When row_format is mixed or statement format, the size of the binlog changes. Regardless of whether the data is actually updated, MySQL records the executed SQL to the binlog.

Three conclusions

In row-based mode, the server layer matches the record to be updated and finds that the new value is consistent with the old value. It does not update the record and returns directly without recording the binlog.

Based on the statement or mixed format, MySQL executes the update statement and records the update statement to the binlog.

So why do statement and mixed record the complete SQL statement? I will explain this in the next article, because I need to parse the source code and have not yet succeeded in compiling the MySQL debugging environment using Clion.

The above is an example to verify whether the MySQL|update field will record the details of the binlog when it has the same value. For more information about the MySQL update field, please pay attention to other related articles on 123WORDPRESS.COM!

You may also be interested in:
  • MySQL update fields from one table to another
  • MySQL UPDATE statement to replace part of the content in a field
  • Detailed analysis of the syntax of Mysql update to modify multiple fields and

<<:  Alibaba Cloud Nginx configures https to implement domain name access project (graphic tutorial)

>>:  Pull-down refresh and pull-up loading components based on Vue encapsulation

Recommend

Detailed explanation of react setState

Table of contents Is setState synchronous or asyn...

Difference between var and let in JavaScript

Table of contents 1. Scopes are expressed in diff...

Implementing a distributed lock using MySQL

introduce In a distributed system, distributed lo...

MySQL data compression performance comparison details

Table of contents 1. Test environment 1.1 Hardwar...

Understanding JavaScript prototype chain

Table of contents 1. Understanding the Equality R...

Setting up shadowsocks+polipo global proxy in Linux environment

1. Install shadowsocks sudo apt-get install pytho...

Install ethereum/Ethereum from scratch under CentOS7

Table of contents Preface Add sudo write permissi...

HTML multimedia application: inserting flash animation and music into web pages

1. Application of multimedia in HTML_falsh animat...

MySQL data type details

Table of contents 1. Numeric Type 1.1 Classificat...

MySQL 5.7.12 installation and configuration tutorial under Mac OS 10.11

How to install and configure MySQL on Mac OS 10.1...

A brief discussion on MySQL count of rows

We are all familiar with the MySQL count() functi...

Implementing shopping cart function based on vuex

This article example shares the specific code of ...

Detailed explanation of the abbreviation of state in react

Preface What is state We all say that React is a ...

JavaScript to achieve simple drag effect

This article shares the specific code of JavaScri...