Database
MySql

Mysql Out Of Sort Memory, Consider Increasing Server Sort Buffer Size

In this tutorial we will go over the demonstration of Out of sort memory. step by step explain consider increasing server sort buffer size mysql. you'll learn mysql 8 out of sort memory consider increasing server sort buffer size. i would like to show you out of sort memory consider increasing server sort buffer size ubuntu. Let's get started with Out of sort memory.

  • 4.5/5.0
  • Last updated 08 September, 2022
  • By Admin

few days ago i was working on laravel project and when i run one following sql query, it was working on local mysql. but not working on ubuntu server in digitalocean. it tried to run using mysql command and i was able to found exactly error:

Query:
select * from `posts` where exists (select * from `categories` inner join `post_category` on `categories`.`id` = `post_category`.`category_id` where `posts`.`id` = `post_category`.`post_id` and `categories`.`slug` = 'phpexample.html') group by `posts`.`id` order by `posts`.`id` desc

Error Found

ERROR 1038 (HY001): Out of sort memory, consider increasing server sort buffer size
Solution:

I search on google and find out solution with increasing size of "sort_buffer_size". so let's open my.cnf file update as like bellow:

sudo nano /etc/mysql/my.cnf

Update as following:

/etc/mysql/my.cnf
[mysqld]
sort_buffer_size=5M

now you can restart mysql with following command

sudo service mysql restart

I hope it can help you...