MYSQL出现:Out of sort memory, consider increasing server sort buffer size; nested exception is java.sql.SQLException: Out of sort memory, consider increasing server sort buffer size
Java接口忽然报错,错误信息是Out of sort memory, consider increasing server sort buffer size。
字面意思就是 sort内存溢出,考虑增加服务器的排序缓冲区(sort_buffer_size)大小。
mysql> show variables like '%sort_buffer_size%';
+-------------------------+---------+
| Variable_name | Value |
+-------------------------+---------+
| innodb_sort_buffer_size | 1048576 |
| myisam_sort_buffer_size | 8388608 |
| sort_buffer_size | 262144 |
+-------------------------+---------+
3 rows in set (0.01 sec)
可以看到 sort_buffer_size ,此时需要将对应的数据调大
mysql> SET GLOBAL sort_buffer_size = 1024*1024;
Query OK, 0 rows affected (0.00 sec)
重新测试
补充:EXPLAIN分析sql运行情况