innodb-隱式提交

隱式提交

1.DDL語句或者修改數據庫對象的語句

Data definition language (DDL) statements that define or modify database objects.
例如:
ALTER DATABASE … UPGRADE DATA DIRECTORY NAME, ALTER EVENT, ALTER PROCEDURE, ALTER SERVER, ALTER TABLE, ALTER VIEW, CREATE DATABASE, CREATE EVENT, CREATE INDEX, CREATE PROCEDURE, CREATE SERVER, CREATE TABLE, CREATE TRIGGER, CREATE VIEW, DROP DATABASE, DROP EVENT, DROP INDEX, DROP PROCEDURE, DROP SERVER, DROP TABLE, DROP TRIGGER, DROP VIEW, RENAME TABLE, TRUNCATE TABLE.

創建表語句是在一個單獨的事務中,因此用戶不能通過rollback來回滾該事務。

The CREATE TABLE statement in InnoDB is processed as a single transaction. This means that a ROLLBACK from the user does not undo CREATE TABLE statements the user made during that transaction.

create table select會導致一個隱式提交,但是create temporary table select不會導致一個隱式提交。

CREATE TABLE … SELECT causes an implicit commit before and after the statement is executed when you are creating nontemporary tables. (No commit occurs for CREATE TEMPORARY TABLE … SELECT.)

2.隱式修改數據庫表的語句也會導致一個隱式提交

Statements that implicitly use or modify tables in the mysql database
例如:
ALTER USER, CREATE USER, DROP USER, GRANT, RENAME USER, REVOKE, SET PASSWORD.

3.事務控制語句、特殊鎖操作會導致隱式提交
在一個事務中獲取一個非事務性表的表鎖,然後使用UNLOCK TABLES會提交一個事務

UNLOCK TABLES commits a transaction only if any tables currently have been locked with LOCK TABLES to acquire nontransactional table locks

mysql不支持事務嵌套。當你在當前事務中再次執行START TRANSACTION,將會隱式提交當前事務。

Transactions cannot be nested. This is a consequence of the implicit commit performed for any current transaction when you issue a START TRANSACTION statement or one of its synonyms.

4.數據加載語句會導致隱式提交

Data loading statements.
例如:
LOAD DATA. LOAD DATA causes an implicit commit only for tables using the NDB storage engine.
注:這裏只是對inndob引擎的表有效。

5.mysql管理語句會導致隱式提交

Administrative statements
例如:
ANALYZE TABLE, CACHE INDEX, CHECK TABLE, FLUSH, LOAD INDEX INTO CACHE, OPTIMIZE TABLE, REPAIR TABLE, RESET

6.主從賦值控制操作語句會導致隱式提交

Replication control statements
例如:
START SLAVE, STOP SLAVE, RESET SLAVE, CHANGE MASTER TO.

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章