Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

767
Views
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

over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

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.

over 4 years ago · Santiago Trujillo Report

0

First thing, 402653184 (byte) which is around 400 MB, if you are not sure about this memory limit then increase a bit more

    command:
      - --default-authentication-plugin=mysql_native_password
      - --innodb-buffer-pool-size=1G

And then verify the changes inside your container.

SELECT @@innodb_buffer_pool_size/1024/1024/1024;
#it should return 1GB

Also, there is a possibility that something else causing the issue, you can check CPU, memory and slow query logs

SHOW ENGINE INNODB STATUS

you can then analyse the output base on current buffer pool size

BUFFER POOL AND MEMORY
----------------------
BUFFER POOL AND MEMORY
----------------------
Total large memory allocated 412090368
Dictionary memory allocated 380237
Buffer pool size   24576
Free buffers       23618
Database pages     954
Old database pages 372
Modified db pages  0
Pending reads      0


MySQL optimization

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!