標籤:
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 事務表和非事務表