Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mysql2::Error: Out of sort memory, consider increasing server sort buffer size using docker-compose.yml

Hi I'm building a rails app and I imported lots of data and inserted into the database. Some tables are okay and some tables have some errors that says out of sort memory.

SQL ERROR

Mysql2::Error: Out of sort memory, consider increasing server sort buffer size

How do you increase server sort buffer size using the docker-compose.yml command?

I've tried this one:

version: '3'
services:
  db:
    image: mysql:latest
    command:
      - --default-authentication-plugin=mysql_native_password
      - --innodb-buffer-pool-size=402653184

I did add this command:

--innodb-buffer-pool-size=402653184

but I'm still getting the same error that it is out of memory. Is there any way to increase the buffer size using the docker-compose.yml

like image 286
laurence keith albano Avatar asked Jul 29 '26 23:07

laurence keith albano


1 Answers

Turns out when I've tested this, this resolves my error in the mysql container in docker.

Add this command in docker-compose.yml under your db services to increase your memory.

--sort_buffer_size=1073741824

To remove the error when your application is running on docker.

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

Note that 1073741824 is equal to bytes and will result to 1GB memory allocation.

like image 57
laurence keith albano Avatar answered Jul 31 '26 18:07

laurence keith albano



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!