简体   繁体   English

用于更新MyISAM和InnoDB表的事务的InnoDB行为

[英]InnoDB behavior for a transaction updating MyISAM and InnoDB tables

I read most of example InnoDB on this website but I have no clue for InnoDB behavior. 我在该网站上阅读了大多数示例InnoDB,但是我对InnoDB的行为一无所知。

As far As I found out 据我发现

START TRANSACTION;

Is declaring this is a transaction connection. 声明这是一个事务连接。 It's OK till here. 到这里没关系。 NOW I have 3 tables: 现在我有3张桌子:

  • tbl1 with InnoDB engine 带有InnoDB引擎的tbl1
  • tbl2 MyISAM Engine tbl2 MyISAM引擎
  • tbl3 InnoDB tbl3 InnoDB

Sequence of updates: 更新顺序:

SET AUTOCOMMIT=0
START TRANSACTION;
UPDATE tbl2 SET column=1 WHERE (SELECT clumn FROM tbl WHERE column2=1);
UPDATE tbl3 SET column=1;
Rollback;

What will happen to MyISAM table is it rollback or only tbl3 and tbl1 will be rollback? MyISAM表将发生回滚还是仅tbl3和tbl1将回滚?

MyISAM doesn't know anything about transactions, and it cannot roll back changes. MyISAM对事务一无所知,也无法回滚更改。

So if you roll back, the changes to tbl3 will be discarded, but the changes to tbl2 will remain. 因此,如果您回滚,对tbl3的更改将被丢弃,但对tbl2的更改将保留。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM