Applies To | All MySQL Sources |
Error Message Text(s) | Out of sort memory, consider increasing server sort buffer size. |
Potential Causes
- This error occurs when the buffer size required for executing a query is larger than the
sort_buffer_size
value configured for the MySQL server.
Suggested Actions
-
Use indexed tables. Indices help in querying the table faster, by reducing the number of rows to be scanned. Creating indices is preferred over increasing the
sort_buffer_size
as the latter may slow down your queries. -
If you have indexed tables but still face the error, increase
sort_buffer_size
:-
Navigate to your MySQL Server install directory.
-
Open the config file:
-
my.ini
in the case of Windows. -
my.cnf
in the case of Linux.
-
-
Search for the
sort_buffer_size
parameter in the file or add it if it does not exist. -
Set the required buffer size as shown below:
sort_buffer_size = <required_size>
For example, to set the value to 1 gigabyte, use one of the following:
sort_buffer_size = 1073741824 sort_buffer_size = 1G
-
Restart your MySQL server for the changes to take effect.
-
See Also
Revision History
Refer to the following table for the list of key updates made to this page:
Date | Release | Description of Change |
---|---|---|
Sep-05-2022 | NA | Brought this page under its respective Source documentation folder. |
Sep-09-2021 | 1.71 | New document. |