Comment 10 for bug 1635927

Revision history for this message
Nickolay Ihalainen (ihanick) wrote : Re: Memory leak when using per-query variables to set MAX_STATEMENT_TIME

Default options for mysql-test-run & mysql 5.6,
Table type could be myisam or innodb.

500MB RSS and 1GB VSZ increase for each 10k queries.
A simple change (e.g. remove subquery) makes memory stable.

CREATE TABLE test.data (
row_key int NOT NULL DEFAULT 0,
ref_key bigint(20) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
INSERT INTO test.data (ref_key) VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
set @row_id := 0;
INSERT INTO test.data (ref_key) SELECT @row_id := @row_id + 11 as ref_key FROM test.data t1, test.data t2, test.data t3, test.data t4, test.data t5;

QUERY=" SELECT count(1) FROM test.data s JOIN (SELECT row_key, ref_key AS ref_key FROM test.data t WHERE t.row_key IN (SELECT row_key FROM test.data) ) AS r;"

ps -o rss,vsz,cmd -p `pgrep -xn mysqld` | cat
(for i in `seq 10000` ; do $MYSQL_CLI -e "SET STATEMENT max_statement_time=1 FOR $QUERY" 2>&1 > /dev/null ; done) 2>&1 > /dev/null