MyIsam engine transaction support
Solution 1
MyISAM effectively works in auto-commit mode (as it's not a transactional engine), and it just ignores the commit/rollback.
Actually storage engine is a different layer in the MySQL architecture, separated from the SQL parser, the SQL layer communicates to the storage engine with lower-level API, and that's the reason there is a common SQL and engines, supporting different subset of featured. You can see very high-level overview of the architecture here
Solution 2
MyIsam tabels were not built for this. Not even in the 5+ versions. It only was meant to store data. It gives you no guarantee for transactions or data recovery. You should use InnoDB for this and, if needed, use MyIsam for replication purposes (it's faster to retrieve data with MyIsam tables since there's no cross-table checks).
You may read this post from MySQL http://forums.mysql.com/read.php?21,68686,69229#msg-69229
Related videos on Youtube
Headshota
Hey there! My name is Shota Bakuradze, I'm a software developer. Currently into Ruby and Rust. I love coding, learning about programming fundamentals and best practices. In spare time I enjoy playing my guitar, train mixed martial arts and sometimes even do some photography.
Updated on November 08, 2020Comments
-
Headshota over 3 years
I was testing transaction support in innoDB tables, and just for the curriosity I tried to run the same transaction on MyIsam table, and surprisingly it worked. I am assuming that on myIsam table queries are executed one after another not in one atomic operation and I don't get any errors from START TRANSACTION and COMMIT and ROLLBACK operations. I am interested, is MyIsam engine just ignoring this operations or does it perform some actions?
-
Álvaro González over 12 years"worked" means that you were able to rollback a DML statement or that you didn't get syntax errors?
-
Headshota over 12 yearsI did a simple select and insert statements and didn't received any errors.
-
Álvaro González over 12 yearsWell, then see @Darhazer's answer. You might get no errors but you won't actually have transactions. Your
INSERT
won't be undone when you issueROLLBACK
.
-