MySQL Variables max_length_for_sort_data 数据库 参数变量解释及正确配置使用


本站中文解释

max_length_for_sort_data参数控制MySQL将用于排序的缓冲区(也称为排序缓冲区)的最大大小。排序缓冲区是MySQL使用排序算法进行排序时使用的临时缓冲区,并且MySQL将在排序缓冲区中存储排序的行。

本参数的值由操作系统的可用内存来定义,一般来说,操作系统提供的最大内存可用量为4GB。但是,您可以更改max_length_for_sort_data参数,以将其更改为更高或更低的值。

如果您想要将此参数更改为更高的值,可以在mysql.conf配置文件(通常位于/etc/mysql/my.cnf中)中修改max_length_for_sort_data参数,如下所示:

max_length_for_sort_data = [value]

最后,记住在更改参数值后,要记得重启MySQL服务器,以使新的参数生效。

官方英文解释

max_length_for_sort_data

Command-Line Format--max-length-for-sort-data=#
System Variablemax_length_for_sort_data
ScopeGlobal, Session
DynamicYes
TypeInteger
Default Value1024
Minimum Value4
Maximum Value8388608
Unitbytes

The cutoff on the size of index values that determines which
filesort algorithm to use. See
Section 8.2.1.14, “ORDER BY Optimization”.