mysql混合存储类型对事务影响
Mixing storage engines in transactions
MySQL doesn’t manage transactions at the server level. Instead, the underlying storage
engines implement transactions themselves. This means you can’t reliably mix
different engines in a single transaction. MySQL AB is working on adding a higherlevel
transaction management service to the server, which will make it safe to mix
and match transactional tables in a transaction. Until then, be careful.
If you mix transactional and nontransactional tables (for instance, InnoDB and
MyISAM tables) in a transaction, the transaction will work properly if all goes well.
However, if a rollback is required, the changes to the nontransactional table can’t beundone. This leaves the database in an inconsistent state from which it may be difficult
to recover and renders the entire point of transactions moot. This is why it is
really important to pick the right storage engine for each table.
MySQL will not usually warn you or raise errors if you do transactional operations
on a nontransactional table. Sometimes rolling back a transaction will generate the
warning “Some nontransactional changed tables couldn’t be rolled back,” but most
of the time, you’ll have no indication you’re working with nontransactional tables.
MySQL doesn’t manage transactions at the server level. Instead, the underlying storage
engines implement transactions themselves. This means you can’t reliably mix
different engines in a single transaction. MySQL AB is working on adding a higherlevel
transaction management service to the server, which will make it safe to mix
and match transactional tables in a transaction. Until then, be careful.
If you mix transactional and nontransactional tables (for instance, InnoDB and
MyISAM tables) in a transaction, the transaction will work properly if all goes well.
However, if a rollback is required, the changes to the nontransactional table can’t beundone. This leaves the database in an inconsistent state from which it may be difficult
to recover and renders the entire point of transactions moot. This is why it is
really important to pick the right storage engine for each table.
MySQL will not usually warn you or raise errors if you do transactional operations
on a nontransactional table. Sometimes rolling back a transaction will generate the
warning “Some nontransactional changed tables couldn’t be rolled back,” but most
of the time, you’ll have no indication you’re working with nontransactional tables.