查看 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存儲引擎的表。
非事務表的特點是不支持回滾,看下面的列子
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
>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的表,支持回滾操作。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
>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,該參數不夠時,則提示需要更多的空間。