Error "1038 Out of sort memory, consider increasing sort buffer size Error "1038 Out of sort memory, consider increasing sort buffer size symfony symfony

Error "1038 Out of sort memory, consider increasing sort buffer size


Just run mysql query

SET GLOBAL sort_buffer_size = 256000000 // It'll reset after server restart

To set permanent

Edit below file and add

sudo nano /etc/mysql/mysql.conf.d/mysqld.cnfsort_buffer_size = 256000000sudo service mysql restart


You probably need to increase the buffer size of mysql in the /etc/mysql/my.cnf, something like:

[mysqld]sort_buffer_size=256k


There's an outstanding issue with MySQL which causes this error when trying to sort on a table with a json column. It looks like it impacts MySQL >= 8.0.18. As of my reply here, the team is still considering whether this is a bug or not. Please provide feedback on that thread if you're impacted by this.

While increasing the buffer size can be a solution here, IMO it really shouldn't be necessary as even ordering by the numeric primary key on a table with a json column can cause this issue.

In my experience, tweaking the buffer size isn't very reliable as the buffer size is relative to the length of the contents in the json column, so while it may solve the immediate issue, if your data set grows it'll need to be tweaked again.