MyISAM vs InnoDBA series of database operations is called a transaction. An atomic transaction is a series of database operations which either all occur, or all do not occur. If it succeeds, all associated changes on all rows it touches are made permanent. If it fails, none of the changes are made.
InnoDB storage engine;InnoDB storage engine;MyISAM storage engine;MyISAM storage engine;mysql>GRANT ALL ON atom.* TO 'mysql_name'@'client_host';
mysql>CREATE DATABASE atom;
mysql>USE atom;
InnoDB Tablemysql>CREATE TABLE t_innodb(i int primary key)
-> ENGINE = InnoDB;
mysql>INSERT INTO t_innodb VALUES (1),(2);
mysql>ROLLBACK;
mysql>SELECT * FROM t_innodb;
Why is the data still there?
autocommit is enabled in MySQL. Find its current value.
mysql>SELECT @@autocommit;
mysql>INSERT INTO t_innodb VALUES (3),(4),(1),(5);
Was there an error caused by a PRIMARY KEY violation?
mysql>SELECT * FROM t_innodb;
+---+
| i |
+---+
| 1 |
| 2 |
+---+
Was the INSERT statement an atomic tranaction?
MyISAM Tablemysql>CREATE TABLE t_myisam(i int primary key)
-> ENGINE = MyISAM;
MyISAMmysql>INSERT INTO t_myisam VALUES (1),(2);
mysql>INSERT INTO t_myisam VALUES (3),(4),(1),(5);
Was there an error caused by a PRIMARY KEY violation?
mysql>SELECT * FROM t_myisam;
Why were only two rows inserted instead of four?
Why are the contents of this table different?
Does the MyISAM engine support atomic execution of statements?
QUIT to exit out of the server.
mysql>QUIT
Congratulations! You have successfully tested and compared atomicity with the
MyISAM and InnoDB storage engines.