1
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