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
Table of contents Cache function in vue2 Transfor...
The error is as follows: Uncaught TypeError: Cann...
I recently encountered a bug where I was trying t...
Table of contents 1. Four concepts 1. JavaScript ...
Table of contents What is virtual dom? Why do we ...
Prepare a CentOS6 installation disk (any version)...
1. Backup source list The default source of Ubunt...
I. Introduction 1: SSL Certificate My domain name...
1. left(name,4) intercepts the 4 characters on th...
1. Linux under VMware Workstation: 1. Update sour...
Copy code The code is as follows: <html xmlns=...
Today I deployed the free-installation version of...
SELECT * FROM table name limit m,n; SELECT * FROM...
summary During the interview, when discussing abo...
1. In IE, if relative positioning is used, that is...