MySQL事務表和非事務表

來源:互聯網
上載者:User

MySQL事務表和非事務表


MySQL事務表和非事務表

查看 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,該參數不夠時,則提示需要更多的空間。

轉載請註明:
十字螺絲釘
http://blog.chinaunix.net/uid/23284114.html
QQ:463725310
E-MAIL:houora#gmail.com(#請自行替換為@)


聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.