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

Mysql master/slave database synchronization configuration and common errors

As the number of visits increases, for some time-...

Let's talk about Vue's mixin and inheritance in detail

Table of contents Preface Mixin Mixin Note (dupli...

Understanding MySQL clustered indexes and how clustered indexes grow

In this note, we briefly describe What is the B+T...

MySQL 5.7.17 winx64 installation and configuration tutorial

Today I installed the MySQL database on my comput...

JS implementation of Apple calculator

This article example shares the specific code of ...

MySQL horizontal and vertical table conversion operation implementation method

This article uses examples to illustrate how to i...

Detailed explanation of html-webpack-plugin usage

Recently, I used html-webapck-plugin plug-in for ...

Detailed explanation on how to get the IP address of a docker container

1. After entering the container cat /etc/hosts It...

Detailed steps to install Sogou input method on Ubuntu 20.04

1. Install Fcitx input framework Related dependen...

MySQL 5.5.27 installation graphic tutorial

1. Installation of MYSQL 1. Open the downloaded M...

Solution to mysql login warning problem

1. Introduction When we log in to MySQL, we often...

Use of Linux gzip command

1. Command Introduction The gzip (GNU zip) comman...

Essential Handbook for Web Design 216 Web Safe Colors

The color presentation on a web page will be affec...

Vue's vue.$set() method source code case detailed explanation

In the process of using Vue to develop projects, ...