Whether MySQL needs to commit when performing operations such as insert depends on your storage engine. If the engine does not support transactions, such as MyISAM, then commit will have no effect. If it is an engine that supports transactions, such as InnoDB, you need to know whether your transaction supports automatic transaction submission (commit) To see whether your database is automatically committed, you can use mysql> show variables like '%autocommit%'; to check. If it is OFF, it will not be automatically committed and you need to commit manually (you can directly use the "commit;" command on the command line). Otherwise, it will be automatically committed. There are three types of submitted data: explicit submission, implicit submission, and automatic submission. These three types are described below. Explicit Commit A commit done directly with the COMMIT command is an explicit commit. Implicit commit The submission completed indirectly by SQL commands is implicit submission. The commands are:
Automatic submission If AUTOCOMMIT is set to ON, after the insert, modify, or delete statement is executed, The system will submit automatically, this is automatic submission. The format is: SQL>SET AUTOCOMMIT ON; Be careful when using the COMMIT / ROLLBACK commands. COMMIT / ROLLBACK are used after executing DML statements (INSERT / DELETE / UPDATE / SELECT). After a DML statement is executed, the processed data will be placed in the rollback segment (except for SELECT statements), waiting for the user to commit (COMMIT) or rollback (ROLLBACK). When the user executes COMMIT / ROLLBACK, the data placed in the rollback segment will be deleted. (After the SELECT statement is executed, the data is stored in the shared pool. When providing the same data to others for query, it is directly extracted from the shared pool without going to the database, which improves the speed of data query.) All DML statements must be explicitly committed, that is, COMMIT must be executed after the DML statement is executed. Others, such as DDL statements, are implicitly committed. That is to say, after running those non-DML statements, the database has already performed an implicit commit. For example, after running the CREATE TABLE script, the table has been created and you no longer need to perform an explicit commit. You may also be interested in:
|
<<: DOM operation implementation in react
>>: Virtual domain name configuration and test verification under Linux\Nginx environment
Open the centos yum folder Enter the command cd /...
Preface When operating and managing Linux servers...
Installed Docker V1.13.1 on centos7.3 using yum B...
Redis Introduction Redis is completely open sourc...
Deploy database based on docker sudo docker pull ...
yum quick install mysql Add yum repository rpm -U...
Perhaps when I name this article like this, someon...
30 free high-quality English ribbon fonts for down...
Table of contents 1. CDN introduction 1.1 react (...
1. Overflow Overflow is overflow (container). Whe...
In the Linux system, there is a kind of file call...
Table of contents 1. Parent passes value to child...
When inserting a set of data into the MySQL datab...
Table of contents 1. Operators Summarize 1. Opera...
1. Make sure the system has the required libaio s...