Some of our clients getting this Mysql memory allocation issue in their environment. This error occurs when Mysql memory is insufficient to perform a query.
Cause of the Mysql Error 1038:
Error "1038 Out of memory, consider increasing server sort buffer size
This situation points that the Mysql assigned memory is not enough to perform a MySQL query. To perform every session, the sort allocates a buffer of this size.
Method to Fix this Issue:
In order to fix this error, we have to optimize the query or increase the sort_buffer_size variable value for Mysql.
The sort_buffer_size variable controls how large a filesort buffer is, which means that whenever a query needs to sort the rows, the value given to this variable is used to limit the size that needs to be allocated.
You can increase the mysql sort_buffer size in two ways ;
1. Using Mysql query (temporary method)
You can do it by running the given query
SET GLOBAL sort_buffer_size = 256000000
But it will reset after the restart.
We can increase the sort_buffer_size in the /etc/my.cnf or in /etc/mysql/mysql.conf.d/ or /etc/mysql/conf.d/ (depends upon your MySQL configuration file).
[mysqld]
sort_buffer_size = 256 k
You need to restart the Mysql server after the changes are done.
service mysqld restart
If you are facing any issues with your Mysql server, contact our support team right now to get it fixed.