mysql Out of memory (Needed 16777224 bytes)的错误解决
2012-07-25 00:00
866 查看
这几天碰到这个错误。
至于我改的这几个值是不是正确的解决方法,目前还不知道。先贴出来。
如果过一段时间我还是没有更新,那以后同志们都参考吧 。
Out of memory (Needed 16777224 bytes)的错误解决
看看手册:
http://dev.mysql.com/doc/refman/5.1/en/memory-storage-engine.html
开始我更改了query_cache_size的值。
好像也不行。
之后
增大query_cache_limit 的值。
还有max_heap_table_size
和tmp_table_size的值。
因为我们的存储过程中用了好多的预处理语句。而且语句的结果都是非常大的。
起初我的结果:
mysql> show variables like 'max_heap_table_size';
+---------------------------------+----------------------+
| Variable_name | Value |
+---------------------------------+----------------------+
| max_heap_table_size | 16777216 |
+---------------------------------+----------------------+
mysql> show variables like 'tmp_table_size';
+---------------------------------+----------------------+
| Variable_name | Value |
+---------------------------------+----------------------+
| tmp_table_size | 16777216 |
+---------------------------------+----------------------+
我改了my.cnf文件
mysql> show variables like 'max_heap_table_size';
+---------------------------------+----------------------+
| Variable_name | Value |
+---------------------------------+----------------------+
| max_heap_table_size | 67108864 |
+---------------------------------+----------------------+
mysql> show variables like 'tmp_table_size';
+---------------------------------+----------------------+
| Variable_name | Value |
+---------------------------------+----------------------+
| tmp_table_size | 67108864 |
+---------------------------------+----------------------+
顺便看一下这篇文章中的一段话: http://dev.mysql.com/tech-resources/articles/mysql-query-cache.html
Qcache_hits and Qcache_inserts shows the number of times a query was serviced from the cache and how many queries have been inserted into the cache. Low ratios of hits to inserts indicate little query reuse or a too-low setting of the query_cache_limit, which serves to govern the RAM devoted to each individual query cache entry. Large query result sets will require larger settings of this variable.
补充:
今天在手册上看到这段话
http://dev.mysql.com/doc/refman/5.1/en/out-of-memory.html
If you issue a query using the mysql client program and receive an error like the following one, it means that mysql does not have enough memory to store the entire query result:
所以我把我的所有存储过程都修改了。
因为里面的预处理语句没有清零。
经过测试。
比如:
里面用到
PREPARE S1 FROM @STMT;
...
一定要
SET @STMT = '';
不知道这个是不是根本原因。我会再次更新的。
再次证明这样做会减少这种情况。不过下午把所有存储过程修改了。
凡是普通连接的都改为LEFT JOIN 了。通过EXPLAIN建立了相关索引。
而且把版本换成了5.0.45。至于是否还是出现错误。还在继续关注中。。。目前没有任何错误。
这个问题貌似MYSQL官方解决了。 http://bugs.mysql.com/bug.php?id=31898
至于我改的这几个值是不是正确的解决方法,目前还不知道。先贴出来。
如果过一段时间我还是没有更新,那以后同志们都参考吧 。
Out of memory (Needed 16777224 bytes)的错误解决
看看手册:
http://dev.mysql.com/doc/refman/5.1/en/memory-storage-engine.html
开始我更改了query_cache_size的值。
好像也不行。
之后
增大query_cache_limit 的值。
还有max_heap_table_size
和tmp_table_size的值。
因为我们的存储过程中用了好多的预处理语句。而且语句的结果都是非常大的。
起初我的结果:
mysql> show variables like 'max_heap_table_size';
+---------------------------------+----------------------+
| Variable_name | Value |
+---------------------------------+----------------------+
| max_heap_table_size | 16777216 |
+---------------------------------+----------------------+
mysql> show variables like 'tmp_table_size';
+---------------------------------+----------------------+
| Variable_name | Value |
+---------------------------------+----------------------+
| tmp_table_size | 16777216 |
+---------------------------------+----------------------+
我改了my.cnf文件
mysql> show variables like 'max_heap_table_size';
+---------------------------------+----------------------+
| Variable_name | Value |
+---------------------------------+----------------------+
| max_heap_table_size | 67108864 |
+---------------------------------+----------------------+
mysql> show variables like 'tmp_table_size';
+---------------------------------+----------------------+
| Variable_name | Value |
+---------------------------------+----------------------+
| tmp_table_size | 67108864 |
+---------------------------------+----------------------+
顺便看一下这篇文章中的一段话: http://dev.mysql.com/tech-resources/articles/mysql-query-cache.html
Qcache_hits and Qcache_inserts shows the number of times a query was serviced from the cache and how many queries have been inserted into the cache. Low ratios of hits to inserts indicate little query reuse or a too-low setting of the query_cache_limit, which serves to govern the RAM devoted to each individual query cache entry. Large query result sets will require larger settings of this variable.
补充:
今天在手册上看到这段话
http://dev.mysql.com/doc/refman/5.1/en/out-of-memory.html
If you issue a query using the mysql client program and receive an error like the following one, it means that mysql does not have enough memory to store the entire query result:
所以我把我的所有存储过程都修改了。
因为里面的预处理语句没有清零。
经过测试。
比如:
里面用到
PREPARE S1 FROM @STMT;
...
一定要
SET @STMT = '';
不知道这个是不是根本原因。我会再次更新的。
再次证明这样做会减少这种情况。不过下午把所有存储过程修改了。
凡是普通连接的都改为LEFT JOIN 了。通过EXPLAIN建立了相关索引。
而且把版本换成了5.0.45。至于是否还是出现错误。还在继续关注中。。。目前没有任何错误。
这个问题貌似MYSQL官方解决了。 http://bugs.mysql.com/bug.php?id=31898
相关文章推荐
- mysql Out of memory (Needed 16777224 bytes)的错误解决
- Out of memory (Needed 16777224 bytes)的错误解决
- Out of memory (Needed 16777224 bytes)的错误解决
- mysqld-nt: Out of memory (Needed 1677720 bytes)解决方法
- 一图解决:navicat for mysql 导入.sql大文件 报out of memory 错误
- Gerrit 执行 git pull 的时候,提示 fatal: Out of memory, malloc failed (tried to allocate *** bytes)错误的解决方法
- mysql出现out of memory错误的解决方法
- mysqld-nt: Out of memory (Needed 1677720 bytes)解决方法
- mysqld-nt: Out of memory (Needed 1677720 bytes)解决方法
- 关于MongoDB在64位服务器上依然报 mmap failed with out of memory 错误的解决方法(附Mysql性能对比测试)
- 解决domino服务器错误:out of memory
- Caused by: java.lang.OutOfMemoryError: Java heap space错误原因及解决方法
- 正确使用MySQL JDBC setFetchSize()方法解决JDBC处理大结果集 java.lang.OutOfMemoryError: Java heap space
- PHP错误Allowed memory size of 67108864 bytes exhausted的3种解决办法
- java.lang.OutOfMemoryError错误解决方法
- Eclipse 报 “Exception in thread "main" java.lang.OutOfMemoryError: Java heap space ”错误的解决办法
- Eclipse 报 “Exception in thread "main" java.lang.OutOfMemoryError: Java heap space ”错误的解决办法
- java.lang.OutOfMemoryError: Java heap space 错误及解决办法
- myeclipse tomcat java.lang.OutOfMemoryError: PermGen space错误的解决方法
- 解决Eclipse和MyEclipsejava.lang.OutOfMemoryError Java heap space的错误