当前位置:Gxlcms > 数据库问题 > MySQL 事务表和非事务表

MySQL 事务表和非事务表

时间:2021-07-01 10:21:17 帮助过:2人阅读

MySQL 事务表和非事务表

查看 max_binlog_stmt_cache_size 参数解释时(入门教程qkxue.net),有这么一句话 If nontransactional statements within a transaction require more than this many bytes of memory, the server generates an error.


那么,什么是 nontransactional statements ?


在 http://dev.mysql.com/ 查找 nontransactional关键字,出来的第一个是 Rollback Failure for Nontransactional Tables 。


那么什么又是 Nontransactional Tables ?


Nontransactional Tables(腾云科技ty300.com),非事务表,不支持事务的表,也就是使用MyISAM存储引擎的表。


非事务表的特点是不支持回滚,看下面的列子
  

 >create table no_trans(id int) ENGINE=MyiSAM;

    >start transaction;

    >insert into no_trans values(1);

    >select * from no_trans;

    +------+

    | id   |

    +------+

    |    1 |

    +------+

    1 row in set (0.00 sec)

     

    >rollback;

    Query OK, 0 rows affected, 1 warning (0.00 sec)

     

    >show warnings;

    +---------+------+---------------------------------------------------------------+

    | Level   | Code | Message                                                       |

    +---------+------+---------------------------------------------------------------+

    | Warning | 1196 | Some non-transactional changed tables couldn‘t be rolled back |

    +---------+------+---------------------------------------------------------------+

    1 row in set (0.00 sec)

     

    >select * from no_trans;

    +------+

    | id   |

    +------+

    |    1 |

    +------+

    1 row in set (0.00 sec)

 可以看到,非事务表回滚抛出警告,显示非事务表不支持回滚。

与非事务表对象的是事务表,比如使用InnoDB的表,支持回滚操作。

稿源:勤快学QKXue.NET

阅读图文完整版MySQL 事务表和非事务表

MySQL 事务表和非事务表

标签:

人气教程排行