I have a reproducer for the "Out of memory" error being logged (not a crash), it is currently not trivial.
After increasing aria_pagecache_buffer_size from 128MB to 2048MB I no longer saw the "Out of memory" error in the error log, instead the mysql client returns "Using too big key for internal temp tables". Both errors go away when I remove the line:
group_concat_max_len=131072
from the my.cnf file. Without the line the reported global default value of 1024 is being used. I also get the error using 65536, 32768, 16384, 8192, 4096 and 2048, only with 1024 does it run error free.
The queries with the errors are using GROUP_CONCAT.
"Out of memory" query:
UPDATE
p_prelim_org AS pre
JOIN ( SELECT pre.encore_load, pre.cfterm_id, GROUP_CONCAT( CONCAT("[", fin_sec.label, "]") ORDER BY fin_sec.indent ASC SEPARATOR '' ) AS sub_label,
MAX( fin_sec.indent ) AS sub_indent
FROM p_prelim_org AS pre
JOIN p_prelim_org AS sub_check
ON pre.encore_load = sub_check.encore_load AND pre.cfterm_id_match = sub_check.cfterm_id AND pre.status = "MATCHED" AND pre.whos_structure = "FINAL" AND pre.indent_match + 1 < sub_check.indent AND pre.table_type = "CF"
JOIN p_final_sections AS fin_sec
ON pre.encore_load = fin_sec.encore_load AND pre.cfterm_id_match = fin_sec.cfterm_id AND pre.indent_match >= fin_sec.indent
GROUP BY pre.encore_load, pre.cfterm_id
) AS sub_sec
ON pre.encore_load = sub_sec.encore_load AND pre.cfterm_id = sub_sec.cfterm_id
SET pre.whos_structure = "PRELIM", pre.section_label = sub_sec.sub_label, pre.indent = sub_sec.sub_indent + 1, pre.source = CONCAT( 'Used FINAL struct, ', pre.source )
EXPLAIN on the inner select:
*************************** 1. row ***************************
id: 1
select_type: SIMPLE
table: pre
type: ALL
possible_keys: PRIMARY
key: NULL
key_len: NULL
ref: NULL
rows: 76
Extra: Using where; Using filesort
*************************** 2. row ***************************
id: 1
select_type: SIMPLE
table: sub_check
type: eq_ref
possible_keys: PRIMARY
key: PRIMARY
key_len: 5
ref: ffar_load_a.pre.encore_load,ffar_load_a.pre.cfterm_id_match
rows: 1
Extra: Using where
*************************** 3. row ***************************
id: 1
select_type: SIMPLE
table: fin_sec
type: ref
possible_keys: PRIMARY
key: PRIMARY
key_len: 5
ref: ffar_load_a.pre.encore_load,ffar_load_a.pre.cfterm_id_match
rows: 2
Extra: Using index condition
"Using too big key for internal temp tables" query:
UPDATE
p_prelim_org AS org
JOIN ( SELECT encore_load,
cfterm_id, GROUP_CONCAT( CONCAT("[",label,"]") ORDER BY indent ASC SEPARATOR '' ) AS full_label,
MAX( indent ) + 1 AS indent
FROM p_raw_sections
GROUP BY encore_load, cfterm_id
) AS slabels
ON
org.encore_load = slabels.encore_load AND
org.cfterm_id = slabels.cfterm_id
SET org.section_label = slabels.full_label, org.indent = slabels.indent;
Explain on the inner select:
+----+-------------+----------------+------+---------------+------+---------+------+------+----------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+----------------+------+---------------+------+---------+------+------+----------------+
| 1 | SIMPLE | p_raw_sections | ALL | NULL | NULL | NULL | NULL | 84 | Using filesort |
+----+-------------+----------------+------+---------------+------+---------+------+------+----------------+
I have a reproducer for the "Out of memory" error being logged (not a crash), it is currently not trivial. buffer_ size from 128MB to 2048MB I no longer saw the "Out of memory" error in the error log, instead the mysql client returns "Using too big key for internal temp tables". Both errors go away when I remove the line: concat_ max_len= 131072
After increasing aria_pagecache_
group_
from the my.cnf file. Without the line the reported global default value of 1024 is being used. I also get the error using 65536, 32768, 16384, 8192, 4096 and 2048, only with 1024 does it run error free.
The queries with the errors are using GROUP_CONCAT.
"Out of memory" query:
UPDATE
pre.encore_ load,
pre.cfterm_ id,
GROUP_ CONCAT( CONCAT("[", fin_sec.label, "]") ORDER BY fin_sec.indent ASC SEPARATOR '' ) AS sub_label,
p_prelim_ org AS pre
p_prelim_ org AS sub_check encore_ load AND
pre. cfterm_ id_match = sub_check.cfterm_id AND
pre. status = "MATCHED" AND
pre. whos_structure = "FINAL" AND
pre. indent_ match + 1 < sub_check.indent AND
pre. table_type = "CF"
p_final_ sections AS fin_sec
pre. cfterm_ id_match = fin_sec.cfterm_id AND
pre. indent_ match >= fin_sec.indent
pre. cfterm_ id = sub_sec.cfterm_id
pre. indent = sub_sec.sub_indent + 1, pre.source = CONCAT( 'Used FINAL struct, ', pre.source )
p_prelim_org AS pre
JOIN ( SELECT
MAX( fin_sec.indent ) AS sub_indent
FROM
JOIN
ON pre.encore_load = sub_check.
JOIN
ON pre.encore_load = fin_sec.encore_load AND
GROUP BY pre.encore_load, pre.cfterm_id
) AS sub_sec
ON pre.encore_load = sub_sec.encore_load AND
SET pre.whos_structure = "PRELIM", pre.section_label = sub_sec.sub_label,
EXPLAIN on the inner select:
******* ******* ******* ****** 1. row ******* ******* ******* ****** ******* ******* ****** 2. row ******* ******* ******* ****** a.pre.encore_ load,ffar_ load_a. pre.cfterm_ id_match ******* ******* ****** 3. row ******* ******* ******* ****** a.pre.encore_ load,ffar_ load_a. pre.cfterm_ id_match
id: 1
select_type: SIMPLE
table: pre
type: ALL
possible_keys: PRIMARY
key: NULL
key_len: NULL
ref: NULL
rows: 76
Extra: Using where; Using filesort
*******
id: 1
select_type: SIMPLE
table: sub_check
type: eq_ref
possible_keys: PRIMARY
key: PRIMARY
key_len: 5
ref: ffar_load_
rows: 1
Extra: Using where
*******
id: 1
select_type: SIMPLE
table: fin_sec
type: ref
possible_keys: PRIMARY
key: PRIMARY
key_len: 5
ref: ffar_load_
rows: 2
Extra: Using index condition
"Using too big key for internal temp tables" query:
UPDATE
encore_ load,
GROUP_ CONCAT( CONCAT( "[",label, "]") ORDER BY indent ASC SEPARATOR '' ) AS full_label,
p_raw_ sections
encore_ load, cfterm_id
p_prelim_org AS org
JOIN ( SELECT
cfterm_id,
MAX( indent ) + 1 AS indent
FROM
GROUP BY
) AS slabels
ON
org.encore_load = slabels.encore_load AND
org.cfterm_id = slabels.cfterm_id
SET org.section_label = slabels.full_label, org.indent = slabels.indent;
Explain on the inner select:
+----+- ------- -----+- ------- ------- -+----- -+----- ------- ---+--- ---+--- ------+ ------+ ------+ ------- ------- --+ ------- -----+- ------- ------- -+----- -+----- ------- ---+--- ---+--- ------+ ------+ ------+ ------- ------- --+ ------- -----+- ------- ------- -+----- -+----- ------- ---+--- ---+--- ------+ ------+ ------+ ------- ------- --+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-
| 1 | SIMPLE | p_raw_sections | ALL | NULL | NULL | NULL | NULL | 84 | Using filesort |
+----+-
CREATE TABLE `p_prelim_org` ( ,'LAST' ) NOT NULL, ,'IS',' CF') DEFAULT NULL, ,'FINAL' ,'MATCHED' ) DEFAULT 'PRELIM', ,'BELOW' ,'UNSET' ) DEFAULT 'UNSET', ,'FINAL' ) DEFAULT 'PRELIM', load`,` cfterm_ id`)
`encore_load` enum('FIRST'
`table_type` enum('BS'
`cfterm_id` int(10) unsigned NOT NULL DEFAULT '0',
`ordering` smallint(5) unsigned DEFAULT NULL,
`indent` tinyint(3) unsigned DEFAULT '0',
`section_label` varchar(2048) DEFAULT '',
`label` varchar(2048) DEFAULT NULL,
`status` enum('PRELIM'
`cfterm_id_match` int(10) unsigned DEFAULT '0',
`location` enum('ABOVE'
`whos_structure` enum('PRELIM'
`indent_match` tinyint(3) unsigned DEFAULT '0',
`source` varchar(200) DEFAULT '',
PRIMARY KEY (`encore_
) ENGINE=MyISAM DEFAULT CHARSET=utf8
CREATE TABLE `p_raw_sections` ( ,'LAST' ) NOT NULL, ,'IS',' CF') DEFAULT NULL, load`,` cfterm_ id`,`indent` ), id`,`parent_ group`)
`encore_load` enum('FIRST'
`table_type` enum('BS'
`cfterm_id` int(10) unsigned NOT NULL DEFAULT '0',
`indent` tinyint(3) unsigned NOT NULL DEFAULT '0',
`ordering` smallint(5) unsigned DEFAULT NULL,
`group_id` tinyint(3) unsigned DEFAULT '0',
`parent_group` tinyint(3) unsigned DEFAULT '0',
`label` varchar(2048) DEFAULT NULL,
PRIMARY KEY (`encore_
KEY `group_id` (`group_
) ENGINE=MyISAM DEFAULT CHARSET=utf8