InnoDB is the transactional storage engine of MySQL, while MyISAM is the non - transactional storage engine. In other words, InnoDB follows ACID properties to maintain data integrity, but MyISAM does not follow ACID properties, thus not maintaining data integrity.
In an InnoDB (transactional) table, transaction changes can be easily rolled back if rollback is required. But changes made to the MyISAM table (not transactional) cannot be undone when a transaction rollback is required.
For example, you want to transfer money from your current account to a savings account. This is done using a transaction that includes 5 queries.
1 START TRANSACTION; 2 SELECT balance FROM checking WHERE customer_id = 10233276; 3 UPDATE checking SET balance = balance - 200.00 WHERE customer_id = 10233276; 4 UPDATE savings SET balance = balance + 200.00 WHERE customer_id = 10233276; 5 COMMIT;
Suppose the process crashes in step 4. If the InnoDB table were used here, the rollback would cancel the changes and you would be free from the risk of losing money. Literally, the table does not know about any failure, since the changes will not be made to the table if step 5 is not successfully completed.
But in the case of the MyISAM table, transactional changes cannot be undone when a rollback is called or in the event of a failure leading to a transaction failure. This means that if the transaction crashed in step 3, the money will be deducted from your current account. But the money would not be added to your savings account.
Courtesy example: "High Performance MySQL: Optimization, Backup, and Replication" - book by Arjen Lenz, Derek J. Balling, Jeremy Zavodny, Peter Zaitsev and Vadim Tkachenko
Steffi Keran Rani J Jul 24 '19 at 11:38 2019-07-24 11:38
source share