---
title: "MySQL Out of Sort Memory"
date: 2020-09-07T10:13:51.000Z
author: Z.SHINCHVEN
tags: [Out of Sort Memory, MySQL]
canonical: https://atlassc.net/2020/09/07/mysql-out-of-sort-memory
---
```error
Error "1038 Out of sort memory, consider increasing server sort buffer size
```

If you encountered this error when sorting over a million rows of data, you should consider adding an index to the column you are sorting instead of enlarging the `sort_buffer_size` config.

[How MySQL Uses Indexes](https://dev.mysql.com/doc/refman/8.0/en/mysql-indexes.html)
