When a company developer executes an insert statement in a test environment, it takes more than 10 seconds to execute successfully. We checked the test environment database performance, data volume, deadlock and other information and found no anomalies. Finally, this problem was solved by modifying the log writing method. 1. Modification MethodModify the /etc/my.cnf file and change innodb_flush_log_at_trx_commit = 1 to 0. However, this will incur the risk of losing data that is not stored in the database within 1 second after the database crashes. The MySQL documentation describes this parameter as follows:
2. Parameter Description
3. NotesWhen set to 0, this mode is the fastest, but less secure. A crash of the mysqld process will result in the loss of all transaction data in the last second. When set to 1, this mode is the safest, but also the slowest. In the event of a mysqld service crash or a server host crash, the binary log may lose at most one statement or one transaction. When set to 2, this mode is faster and safer than 0. All transaction data in the last second may be lost only if the operating system crashes or the system loses power. The two parameters innodb_flush_log_at_trx_commit and sync_binlog are key parameters for controlling MySQL disk write strategy and data security. When both parameters are set to 1, the write performance is the worst. The recommended practice is innodb_flush_log_at_trx_commit=2, sync_binlog=500 or 1000. This is the end of this article about how to solve the problem of MySQL deleting and inserting data very slowly. For more related content about MySQL deleting and inserting data very slowly, please search for previous articles on 123WORDPRESS.COM or continue to browse the related articles below. I hope you will support 123WORDPRESS.COM in the future! You may also be interested in:
|
>>: Analysis of the reasons why Vue3 uses Proxy to implement data monitoring
First, the HTML code to embed the video in the pag...
Table of contents frame First-class error reporti...
This article shares the specific code for the WeC...
Preface The language classification of SQL mainly...
Table of contents 1. Create a socket 2. Bind sock...
1. Mobile selection of form text input: In the te...
From getting started to becoming a novice, the Li...
Mysql join query 1. Basic concepts Connect each r...
After VMware is abnormally shut down, it prompts ...
Today, I fell into the trap again. I have encount...
Mysql query time period intersection Usage scenar...
HTML code: <a onclick="goMessage();"...
Table of contents 1. Literals 1.1 Numeric literal...
Introduction MySQL achieves high availability of ...
Version 1.4.2 Official Documentation dockerhub st...