In symfony2, doctrine2, I have a query which triggers an error :
Error \"1038 Out of sort memory, consider increasing server sort buffer size
T
In my case what actually helped without increasing the sort buffer size was to create indexes for the fields that I was ordering on. I'm not sure if it would work when joining tables but it will work when trying to order a single table which is very large.
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.cnf
sort_buffer_size = 256000000
sudo service mysql restart
If you are using the docker mysql container add the follow setting in docker-compose.yml:
db:
image: mysql:8
command: --sort_buffer_size=512K
You probably need to increase the buffer size of mysql in the /etc/mysql/my.cnf
, set
sort_buffer_size to 256K