MySQL log system redo log, binlog


What is redo log

Redo log (redo log), a metaphor can be used to describe, that is, the hotel manager has a pink board, which is used to record customers’ credit records. If there are not many people on credit, he can write it on the pink board. If there are many people on credit, he can’t write it down, so he needs a bookkeeping book.

At this time, if the guest comes to charge or repay, the shopkeeper can have two ways:
First, open the account book to find the customer’s credit record
The second is to write it directly on the powder board. When there are few guests, or after proofing, write it on the notebook.

When there are a lot of guests, the latter is the most efficient choice

Similarly, MySQL is the same. This is the role of redo log. When a request comes, it modifies the data in the hard disk every time, which consumes a lot of Io. In order to solve this problem, MySQL uses the same design idea to improve the update efficiency.

To put it simply, InnoDB will first record the update operation in the log when updating the record. After writing to the memory, the whole update will be completed. Then, when the system is idle, other factors will persist the data in the redo log to the disk.

If you don’t have much credit today, the shopkeeper can check the contents on the powder board after proofing and write them into the account book. If the powder board is full when there are too many customers, you can only eliminate the contents of the powder board and write them on the powder board again.

Similarly, the redo log also has a size. For example, it can be configured as four groups of files, each of which is 1 GB. Then this powder board can record 4 GB of content, and when it is full, it will start to eliminate the previous circular writing.


Binlog is the log of MySQL server. It is added and written. It records the log of all operations in MySQL.
The difference between redo log and redo log is that redo log is physical and binlog is logical. Since redo belongs to InnoDB engine, binlog is necessary because you can use other engines.

This work adoptsCC agreementReprint must indicate the author and the link of this article

Recommended Today

Lua language novice simple tutorial

1、 Foreword Lua is a lightweight and compact scripting language, which is written in standard C language and open in the form of source code. Its design purpose is to be embedded in the application, so as to provide flexible expansion and customization functions for the application. Lua can be applied in game development, independent […]