MySQL 事务表和非事务表

黄舟
풀어 주다: 2017-02-06 10:32:29
원래의
2100명이 탐색했습니다.

查看 max_binlog_stmt_cache_size 参数解释时,有这么一句话 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,非事务表,不支持事务的表,也就是使用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的表,支持回滚操作。

>create table trans(id int);
>start transaction;
>insert into trans values(1);
>select * from trans;
+------+
| id   |
+------+
|    1 |
+------+
1 row in set (0.00 sec)
 
 
>rollback;
Query OK, 0 rows affected (0.00 sec)
 
 
>select * from trans;
Empty set (0.00 sec)
로그인 후 복사

可以得出,nontransactional statements的意思是操作非事务表的语句。


max_binlog_stmt_cache_size 该参数影响的是非事务表,如MyISAM,该参数不够时,则提示需要更多的空间。


max_binlog_cache_size 该参数影响的是事务表,如InnoDB,该参数不够时,则提示需要更多的空间。

以上就是MySQL 事务表和非事务表的内容,更多相关内容请关注PHP中文网(m.sbmmt.com)!


원천:php.cn
본 웹사이트의 성명
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.
최신 이슈
인기 튜토리얼
더>
최신 다운로드
더>
웹 효과
웹사이트 소스 코드
웹사이트 자료
프론트엔드 템플릿
회사 소개 부인 성명 Sitemap
PHP 중국어 웹사이트:공공복지 온라인 PHP 교육,PHP 학습자의 빠른 성장을 도와주세요!