28

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?

3
  • "worked" means that you were able to rollback a DML statement or that you didn't get syntax errors? Nov 7, 2011 at 11:48
  • I did a simple select and insert statements and didn't received any errors.
    – Headshota
    Nov 7, 2011 at 12:02
  • 5
    Well, 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 issue ROLLBACK. Nov 7, 2011 at 12:04

2 Answers 2

36

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

5

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.