这是 Mysql 在查询数据进行排序时,需要用到的缓存不够导致的,默认才几百kb。可以通过以下方式增加:

查询当前大小 sort_buffer_size
select @@global.sort_buffer_size;

临时进行调整 sort_buffer_size
SET GLOBAL sort_buffer_size = 1024 1024 8;

永久性调整 (编辑 my.ini 或 my.cnf 配置文件)
[mysqld]
sort_buffer_size=8M

注一:sort_buffer_size 设定 1024 1024 8 是什么意思?
即为将 sort_buffer_size 设为 8MB

注二:my.ini 或 my.cnf 的 sort_buffer_size 不生效?
修改配置后,需要重启 MySQL 服务。

标签: none

添加新评论