mysql 常見錯誤

來源:互聯網
上載者:User

標籤:mysql 常見錯誤

Lock wait timeout exceeded; try restarting transaction一些資訊

1、

鎖等待逾時。是當前事務在等待其它事務釋放鎖資源造成的。可以找出鎖資源競爭的表和語句,最佳化你的SQL,建立索引等,如果還是不行,可以適當減少並發線程數。


2、

你的事務在等待給某個表加鎖時逾時了,估計是表正被另的進程鎖住一直沒有釋放。

可以用 SHOW INNODB STATUS/G; 看一下鎖的情況。

3、搜尋解決 之道

在管理 節點的[ndbd default]

區加:

TransactionDeadLockDetectionTimeOut=10000(設定 為10秒)預設是1200(1.2秒)

4、

InnoDB會自動的檢測死結進行復原,或者終止死結的情況。

引用

InnoDB automatically detects transaction deadlocks and rolls back a transaction or transactions to break the deadlock. 

InnoDB tries to pick small transactions to roll back, where the size of a transaction is determined by the number of rows inserted, updated, or deleted.

如果參數innodb_table_locks=1並且autocommit=0時,InnoDB會留意表的死結,和MySQL層面的行級鎖。另外,InnoDB不會檢測MySQL的Lock Tables命令和其他儲存引擎死結。

你應該設定innodb_lock_wait_timeout來解決這種情況。

innodb_lock_wait_timeout是Innodb放棄行級鎖的逾時時間。


mysql 常見錯誤

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.