這幾天碰到這個錯誤。
至於我改的這幾個值是否是正確的解決方法,目前還不知道。先貼出來。
若是過一段時間我仍是沒有更新,那之後同志們都參考吧 。
Out of memory (Needed 16777224 bytes)的錯誤解決
看看手冊:
[url]http://dev.mysql.com/doc/refman/5.1/en/memory-storage-engine.html[/url]
開始我更改了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 |
+---------------------------------+----------------------+
順便看一下這篇文章中的一段話:
[url]http://dev.mysql.com/tech-resources/articles/mysql-query-cache.html[/url]
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.
補充:
今天在手冊上看到這段話
[url]http://dev.mysql.com/doc/refman/5.1/en/out-of-memory.html[/url]
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 = '';
不知道這個是否是根本緣由。我會再次更新的。