天天看點

The total number of locks exceeds the lock table size錯誤(已糾正)

在操作mysql資料庫表時出現以下錯誤。

The total number of locks exceeds the lock table size錯誤(已糾正)

網上google搜尋相關問題,發現一位外國牛人這麼解釋:

if you're running an operation on a large number of rows within a table that uses the innodb storage engine, you might see this error:

error 1206 (hy000): the total number of locks exceeds the lock table size

mysql is trying to tell you that it doesn't have enough room to store all of the row locks that it would need to execute your query. the only way to fix it for sure is to adjust innodb_buffer_pool_size and restart mysql. by default, this is set to only 8mb,

which is too small for anyone who is using innodb to do anything.

if you need a temporary workaround, reduce the amount of rows you're manipulating in one query. for example, if you need to delete a million rows from a table, try to delete the records in chunks of 50,000 or 100,000 rows. if you're inserting many rows, try

to insert portions of the data at a single time.

原來是innodb表執行大批量資料的更新,插入,删除操作時會出現這個問題,需要調整innodb全局的innodb_buffer_pool_size的值來解決這個問題,并且重新開機mysql服務。

檢視目前資料庫存儲引擎,在建立時使用 engine=innodb類型。

預設的innodb_buffer_pool_size=8m

The total number of locks exceeds the lock table size錯誤(已糾正)

修改 innodb_buffer_pool_size的值:

vim /etc/my.cnf

點選(此處)折疊或打開

innodb_buffer_pool_size=64m

再一次重新開機mysql伺服器,執行表操作,成功執行完畢。

參考:

http://blog.csdn.net/slvher/article/details/9532107

繼續閱讀