MYSQL 遭遇 The total number of locks exceeds the lock table size

今天进行MySql 一个表数据的清理,经过漫长等待后出现 The total number of locks exceeds the lock table size 提示。以为是table_cache的值设置小了,于是将其值修改变大, 重启 MySQL 服务,再次执行表的清理操作,经过漫长时间等待后,同样的问题再次出现。网上google搜索相关问题,发现这么一段:

If you’re working with a large InnoDB table and you’re updating, inserting, or deleting a large volume of rows, you may stumble upon this error:

ERROR 1206 (HY000): The total number of locks exceeds the lock table size

InnoDB stores its lock tables in the main buffer pool. This means that the number of locks you can have at the same time is limited by the innodb_buffer_pool_size variable that was set when MySQL was started. By default, MySQL leaves this at 8MB, which is pretty useless if you’re doing anything with InnoDB on your server.

原来是InnoDB表执行大批量数据的更新,插入,删除操作时会出现这个问题,需要调整InnoDB全局的innodb_buffer_pool_size的值来解决这个问题。
于是对照者检查了一下我的表类型,发现果然是InnoDB类型的,于是按照提示,修改 innodb_buffer_pool_size 的值,再一次重启mysql服务器,执行表清理操作,经过漫长时间等待后,终于成功执行完毕。

有无办法不用重启MySQL服务器做清理呢?
按照那篇文章介绍,可以将清理的操作分为几段,每次清理一部分(比如清理5-10%的数据),使每次的清理不会超出lock table size 的限制,这样就可以在不重新启动MySQL的情况下完成数据清理。

Popularity: 4% [?]

Related

Comments

Leave a Reply