How can I speed up insert/update 1-2mb text field in MySQL? -
I write bots that collect web pages, but some pages are 1-2MB (normally larger than Pantip. .com)
Thank you in advance
You definitely need to increase max_allowed_packet and restart mysql. One of MySQL's selected killers is MySQL packet that is controlled.
p> Understand what the MySQL packet can do. According to
, here paragraphs 1-3 are understood:
The MySQL network communication code was written down the assumption that the questions are always weak, and therefore by the server A segment can be sent and processed, which is called packet in the MySQL terminology, the server allocates memory to store packets for a temporary buffer, and it fully assigns it to This request is enough to fit this Iteccr need for caution to avoid being run out of memory the server is a cap on the packet size, which meets this option.
This option is found in the code of interest SQL / net_serv.cc . Take a look at my_net_read () , then follow the call to my_real_read () and pay special attention to net_realloc () .
This variable also limits the length of the results of several string functions. See sql / field.cc and sql / intem_strfunc.cc for details.
Seeing this explanation, bulk INSERTs load / unload a MySQL packet instead of this. This is especially true when max_allowed_packet is too small for the given load of incoming data on it.
Conclusion
In the installation of most MySQL, I usually set it up to 256 m or 512 m for the load of data related to Blob and TEXT areas. Along with big values should be used.
Comments
Post a Comment