Tuesday, December 14, 2010

mysql client out of memory

Error:
Out of memory (Needed 1453192 bytes)
DBD::mysql::st execute failed: MySQL client ran out of memory at file

Solution:
Set this flag in the DB handle -
$rdbh->{'mysql_use_result'} = 1;

It forces the API to use mysql mysql_use_result() instead mysql_store_result().
Basically, instead of buffering all the matches, it returns line by line.
Note that this is the same as --quick option available in the mysql client.

This causes the mysql query thread state to change to "writing to net";
mysql> show processlist\G
...
State: writing to net
...







No comments: