MyIsam 引擎事务支持

2021-11-20 00:00:00 mysql myisam

我正在 innoDB 表中测试事务支持,只是为了好奇我尝试在 MyIsam 表上运行相同的事务,令人惊讶的是它起作用了.我假设在 myIsam 表上的查询一个接一个地执行,而不是在一个原子操作中执行,并且我没有从 START TRANSACTION 和 COMMIT 以及 ROLLBACK 操作中得到任何错误.我很感兴趣,MyIsam 引擎是忽略了这个操作还是执行了一些操作?

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?

推荐答案

MyISAM 在自动提交模式下有效工作(因为它不是事务引擎),它只是忽略提交/回滚.

MyISAM effectively works in auto-commit mode (as it's not a transactional engine), and it just ignores the commit/rollback.

实际上存储引擎是MySQL架构中的一个不同层,与SQL解析器分离,SQL层通过底层API与存储引擎通信,这就是为什么有一个通用的SQL和引擎,支持不同的子集的特色.您可以在此处

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

相关文章