mysql innodb之select for update nowait
作者: 絃樂之花 | 可以轉載, 但必須以超連結形式標明文章原始出處和作者資訊及版權宣告
連結http://shiri512003.itpub.net/post/37713/499937
[@more@]mysql innodb之select for update nowait
習慣了oracle資料庫的select for update nowait的同學,如果轉在mysql環境開發的話,也許會不太適應——目前builtin版本的innodb不支援nowait句法的。早在08年已經被作為bug提了出來()。還好innodb plugin1.0.2開始支援bug文章裡提及的session級innodb_lock_wait_timeout控制(http://dev.mysql.com/doc/innodb-plugin/1.0/en/innodb-other-changes-innodb_lock_wait_timeout.html)
Before InnoDB Plugin 1.0.2, the only way to set this parameter was in the MySQL option file (my.cnf or my.ini), and changing it required shutting down and restarting the server. Beginning with the InnoDB Plugin 1.0.2, the configuration parameter innodb_lock_wait_timeout can be set at runtime with the SET GLOBAL or SET SESSION commands.
該問題的回覆
[5 May 17:08] Bugs System
Pushed into 5.1.47 (revid:joro@sun.com-20100505145753-ivlt4hclbrjy8eye) (version source
revid:vasil.dimov@oracle.com-20100331130613-8ja7n0vh36a80457) (merge vers: 5.1.46)
(pib:16)[6 May 16:58] Paul DuBois
Push resulted from incorporation of InnoDB tree. No changes pertinent to this bug.
Re-closing.
看到該問題也是最終被close掉。值得一提的是目前看到的一些問題都說是5147做fix,mysql51系列啥時候是個頭??50系列目前主流的是508X系列吧,最近facebook釋出了5084的補丁包,而percona則已經發布了5190-b21版本,oracle則磨刀霍霍向55系列。。。
btw,作為對select for update nowait的實現,其實如果資料庫實現不了,其實應用做個超時控制就可以了,把sql執行放到超時控制程式碼裡,具體情況要看開發語言了。
測試:
-- builtin innodb
10:14:37>set innodb_lock_wait_timeout=1;
ERROR 1238 (HY000): Variable 'innodb_lock_wait_timeout' is a read only variable
-- plugin innodb 1.0.7
10:15:35>select @@innodb_version;
+------------------+
| @@innodb_version |
+------------------+
| 1.0.7 |
+------------------+
1 row in set (0.00 sec)
10:15:43>set session innodb_lock_wait_timeout=1;
Query OK, 0 rows affected (0.00 sec)
10:15:54>show variables like 'innodb_lock_wait_timeout';
+--------------------------+-------+
| Variable_name | Value |
+--------------------------+-------+
| innodb_lock_wait_timeout | 1 |
+--------------------------+-------+
1 row in set (0.01 sec)
10:16:02>show global variables like 'innodb_lock_wait_timeout';
+--------------------------+-------+
| Variable_name | Value |
+--------------------------+-------+
| innodb_lock_wait_timeout | 15 |
+--------------------------+-------+
1 row in set (0.00 sec)
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/7591490/viewspace-1033495/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- select for update nowaitAI
- select for update nowait 與 select for update 區別AI
- 關於 select ... for update 和 for update nowaitAI
- MySQL InnoDB update流程MySql
- for update和for update nowaitAI
- FOR UPDATE NOWAIT和 FOR UPDATEAI
- Oracle中的for update 和 for update nowaitOracleAI
- MySQL InnoDB Update和Crash Recovery流程MySql
- MysqL_select for update鎖詳解MySql
- mysql innodb新建索引堵塞update ,insert,deleteMySql索引delete
- mysql update join,insert select 語法MySql
- select for update
- 【Mysql】兩條select for update引起的死鎖MySql
- 【MySQL】select for update 的Row Lock 與Table LockMySql
- MySQL 優化六(InnoDB 下 update 資料出現表鎖之優化)MySql優化
- oracle select for updateOracle
- MySQL update資料時InnoDB內部的操作流程MySql
- MySQL中SELECT+UPDATE併發更新問題MySql
- InnoDB update操作流程圖流程圖
- Mysql之新增innodb支援MySql
- SELECT ... FOR UPDATE SKIP LOCKED;
- mysql之select into outfileMySql
- 記一次 MySQL select for update 死鎖問題MySql
- MySQL 5.7 SELECT ... LOCK IN SHARE MODE|FOR UPDATE語句說明MySql
- mysql 各種級聯查詢後更新(update select).MySql
- SQL update select語句SQL
- Mysql研磨之InnoDB行鎖模式MySql模式
- mysql之InnoDB基礎瞭解MySql
- sql查詢更新update selectSQL
- Oracle中select ... for update的用法Oracle
- Default Locking for INSERT, UPDATE, DELETE, and SELECT ... FOR UPDATE (351)delete
- 深入理解SELECT ... LOCK IN SHARE MODE和SELECT ... FOR UPDATE
- 深入解讀MySQL InnoDB儲存引擎Update語句執行過程MySql儲存引擎
- mysql 高併發 select update 併發更新問題解決方案MySql
- MySQL入門學習之——innodb lockMySql
- select for update與autocommit關係MIT
- 使用select監視update的操作
- oracle connection,select,update 工作原理Oracle