MySQL锁大小错误
2022/7/4 2:22:38
本文主要是介绍MySQL锁大小错误,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
1.The total number of locks exceeds the lock table size(锁的总数超过锁表的大小 )
国外牛人解释:
- 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存储引擎的表中运行一个大量行的操作,你可能会看到这个错误:
- 错误1206 (HY000):锁的总数超过锁表的大小
- MySQL试图告诉您,它没有足够的空间来存储执行查询所需的所有行锁。 唯一确定的修复方法是调整innodb_buffer_pool_size并重启MySQL。 默认情况下,这个值被设置为只有8MB,这对于任何使用InnoDB的人来说都太小了。
- 如果需要临时解决方法,可以减少在一个查询中操作的行数。 例如,如果您需要从一个表中删除100万行,那么尝试以50,000或100,000行的块删除记录。 如果要插入许多行,请尝试一次插入部分数据。
InnoDB表执行大批量数据的更新,插入,删除操作时会出现这个问题,需要调整InnoDB全局的innodb_buffer_pool_size的值来解决这个问题,并且重启mysql服务。
修改 innodb_buffer_pool_size的值:
- innodb_buffer_pool_size=64M(67108864)
show variables like "%_buffer%"; SET GLOBAL innodb_buffer_pool_size=67108864;
启动MySQL时就要分配并且总是存在的全局缓存。
目前有:
key_buffer_size(默认值:402653184,即384M)、
innodb_buffer_pool_size(默认值:134217728即:128M)、
innodb_additional_mem_pool_size(默认值:8388608即:8M)、
innodb_log_buffer_size(默认值:8388608即:8M)、
query_cache_size(默认值:33554432即:32M)等五个。总共:560M.
mysql出现size报错时,一般是这几个值得问题,而这些变量值都可以通过命令如:show variables like '变量名';查看到,并且通过命令如:SET GLOBAL '变量名'='修改后的数值';更改。
这篇关于MySQL锁大小错误的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-11-16MySQL资料:新手入门教程
- 2024-11-16MySQL资料:新手入门教程
- 2024-11-15MySQL教程:初学者必备的MySQL数据库入门指南
- 2024-11-15MySQL教程:初学者必看的MySQL入门指南
- 2024-11-04部署MySQL集群项目实战:新手入门教程
- 2024-11-04如何部署MySQL集群资料:新手入门指南
- 2024-11-02MySQL集群项目实战:新手入门指南
- 2024-11-02初学者指南:部署MySQL集群资料
- 2024-11-01部署MySQL集群教程:新手入门指南
- 2024-11-01如何部署MySQL集群:新手入门教程