MySQL max_allowed_packet param whats the catch?

2019-06-25 17:31发布

问题:

I need to increase the max_allowed_packet param, to fit some theoretically very large items. If I set this param to say 10M, what price if any am I paying compared to setting it to 1M or 4M. Thanks for any input! Tomas

回答1:

I found this explanation: http://www.astahost.com/info.php/max_allowed_packet-mysql_t2725.html

It's safe to increase the value of this variable because the extra memory is allocated only when needed. For example, mysqld allocates more memory only when you issue a long query or when mysqld must return a large result row. The small default value of the variable is a precaution to catch incorrect packets between the client and server and also to ensure that you don't run out of memory by using large packets accidentally.

Also note that I read you have to change the value for both the mysql client and the mysql server.



回答2:

I suggest not touching this variable, instead adjusting your storage implementation to handle any size files using the default settings.

Can you see here for an example.