简体   繁体   English

mysql select with group_concat() - 内存不足

[英]mysql select with group_concat() - Out of memory

we have centos 7 machine with mariadb installed.我们有安装了 mariadb 的 centos 7 机器。

When I run:当我跑步时:

SELECT h.id,
       h.name,
       group_concat(distinct d.name ORDER BY d.name SEPARATOR " ") AS descriptions 
FROM inventar h 
LEFT JOIN descriptions d ON(FIND_IN_SET(d.id, h.description_id) > 0) GROUP BY h.id,h.description_id 
ORDER BY h.name asc;

ERROR 5 (HY000): Out of memory (Needed 65535816 bytes)错误 5 (HY000):内存不足(需要 65535816 字节)

I read that it probably limit of the size of temporary table.我读到它可能限制了临时表的大小。

I checked the size:我检查了尺寸:

MariaDB [wexac_hosts]> show variables like "%table_size%"; MariaDB [wexac_hosts]> 显示像“%table_size%”这样的变量;

Variable_name变量的名称 Value价值
max_heap_table_size最大堆表大小 1048576000 1048576000
tmp_disk_table_size tmp_disk_table_size 18446744073709551615 18446744073709551615
tmp_memory_table_size tmp_memory_table_size 12572426240 12572426240
tmp_table_size tmp_table_size 12572426240 12572426240

it's bigger then 65535816 bytes.它大于 65535816 字节。

Which mysql variable should I increase?我应该增加哪个mysql变量?

If it's GROUP_CONCAT that's running out of memory, you need to increase group_concat_max_len .如果是GROUP_CONCAT内存不足,则需要增加group_concat_max_len

From the GROUP_CONCAT documentation:来自GROUP_CONCAT文档:

The maximum returned length in bytes is determined by the group_concat_max_len server system variable, which defaults to 1M (>= MariaDB 10.2.4) or 1K (<= MariaDB 10.2.3).以字节为单位的最大返回长度由 group_concat_max_len 服务器系统变量确定,默认为 1M (>= MariaDB 10.2.4) 或 1K (<= MariaDB 10.2.3)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM