-
Karthik Kamath authored
STATEMENT PLACEHOLDERS ANALYSIS: ========= Executing a prepared statement to do a multi row insertion with large number of placeholders consumes excessive memory. With binlog enabled, the execution takes a long time too. To write a statement to binlog, the query string is prepared during the execution. The query string preparation in this scenario involves many string append calls to expand heap allocated memory and memcpy. Hence a delay is observed during the statement execution. FIX: ==== A reasonable size of memory is reserved for the query string. Memory of size "original statement string size + 32 times the number of parameters" is reserved to avoid reallocations during string appends in common use cases. The String class enforces a limit of 4 GigaBytes for strings. This can overflow in 64-bit platforms. A check has been added for 64-bit platforms to handle the overflow. It is the responsibility of the caller to ensure that the memory buffer required to hold the string doesn't exceed 4GB. An error is reported if it exceeds 4GB. A test case was not written for this issue due to enviromental limitations. Note: This patch includes a backport of patch for Bug#27699248.
Karthik Kamath authoredSTATEMENT PLACEHOLDERS ANALYSIS: ========= Executing a prepared statement to do a multi row insertion with large number of placeholders consumes excessive memory. With binlog enabled, the execution takes a long time too. To write a statement to binlog, the query string is prepared during the execution. The query string preparation in this scenario involves many string append calls to expand heap allocated memory and memcpy. Hence a delay is observed during the statement execution. FIX: ==== A reasonable size of memory is reserved for the query string. Memory of size "original statement string size + 32 times the number of parameters" is reserved to avoid reallocations during string appends in common use cases. The String class enforces a limit of 4 GigaBytes for strings. This can overflow in 64-bit platforms. A check has been added for 64-bit platforms to handle the overflow. It is the responsibility of the caller to ensure that the memory buffer required to hold the string doesn't exceed 4GB. An error is reported if it exceeds 4GB. A test case was not written for this issue due to enviromental limitations. Note: This patch includes a backport of patch for Bug#27699248.
Loading