Hi, I have run tests to determine memory usage in conjunction with the report here http://bugs.mysql.com/bug.php?id=67259. My test executes queries that create implicit temporary tables with a big enough tmp_table_size that the implicit tmp tables are always created in memory. The version of Percona Server used in the tests is 5.5.15-rel21.0-log First create a table and populate it with data as follows: CREATE TABLE `ti2` ( `c1` int(11) NOT NULL AUTO_INCREMENT, `c2` char(255) DEFAULT NULL, PRIMARY KEY (`c1`) ) ENGINE=InnoDB AUTO_INCREMENT=786406 DEFAULT CHARSET=latin1 mysql> insert into ti2(c2) values('abc'); Query OK, 1 row affected (0.08 sec) mysql> insert into ti2(c2) select c2 from ti2; Query OK, 1 row affected (0.08 sec) Records: 1 Duplicates: 0 Warnings: 0 mysql> insert into ti2(c2) select c2 from ti2; Query OK, 2 rows affected (0.13 sec) Records: 2 Duplicates: 0 Warnings: 0 mysql> insert into ti2(c2) select c2 from ti2; Query OK, 4 rows affected (0.10 sec) Records: 4 Duplicates: 0 Warnings: 0 mysql> insert into ti2(c2) select c2 from ti2; Query OK, 8 rows affected (0.14 sec) Records: 8 Duplicates: 0 Warnings: 0 mysql> insert into ti2(c2) select c2 from ti2; Query OK, 16 rows affected (0.11 sec) Records: 16 Duplicates: 0 Warnings: 0 mysql> insert into ti2(c2) select c2 from ti2; Query OK, 32 rows affected (0.08 sec) Records: 32 Duplicates: 0 Warnings: 0 mysql> insert into ti2(c2) select c2 from ti2; Query OK, 64 rows affected (0.11 sec) Records: 64 Duplicates: 0 Warnings: 0 mysql> insert into ti2(c2) select c2 from ti2; Query OK, 128 rows affected (0.14 sec) Records: 128 Duplicates: 0 Warnings: 0 mysql> insert into ti2(c2) select c2 from ti2; Query OK, 256 rows affected (0.09 sec) Records: 256 Duplicates: 0 Warnings: 0 mysql> insert into ti2(c2) select c2 from ti2; Query OK, 512 rows affected (0.15 sec) Records: 512 Duplicates: 0 Warnings: 0 mysql> insert into ti2(c2) select c2 from ti2; Query OK, 1024 rows affected (0.18 sec) Records: 1024 Duplicates: 0 Warnings: 0 mysql> insert into ti2(c2) select c2 from ti2; Query OK, 2048 rows affected (0.19 sec) Records: 2048 Duplicates: 0 Warnings: 0 mysql> insert into ti2(c2) select c2 from ti2; Query OK, 4096 rows affected (0.23 sec) Records: 4096 Duplicates: 0 Warnings: 0 mysql> insert into ti2(c2) select c2 from ti2; Query OK, 8192 rows affected (0.39 sec) Records: 8192 Duplicates: 0 Warnings: 0 mysql> insert into ti2(c2) select c2 from ti2; Query OK, 16384 rows affected (0.57 sec) Records: 16384 Duplicates: 0 Warnings: 0 mysql> insert into ti2(c2) select c2 from ti2; Query OK, 32768 rows affected (1.21 sec) Records: 32768 Duplicates: 0 Warnings: 0 mysql> insert into ti2(c2) select c2 from ti2; Query OK, 65536 rows affected (2.84 sec) Records: 65536 Duplicates: 0 Warnings: 0 mysql> insert into ti2(c2) select c2 from ti2; Query OK, 131072 rows affected (5.60 sec) Records: 131072 Duplicates: 0 Warnings: 0 mysql> insert into ti2(c2) select c2 from ti2; Query OK, 262144 rows affected (10.95 sec) Records: 262144 Duplicates: 0 Warnings: 0 The table size should be around 152M: mysql> show table status\G *************************** 1. row *************************** Name: ti2 Engine: InnoDB Version: 10 Row_format: Compact Rows: 524349 Avg_row_length: 305 Data_length: 160088064 Max_data_length: 0 Index_length: 0 Data_free: 15728640 Auto_increment: 786406 Create_time: 2012-10-19 11:37:46 Update_time: NULL Check_time: NULL Collation: latin1_swedish_ci Checksum: NULL Create_options: Comment: 1 row in set (0.00 sec) Attached with this comment are 3 scripts: memory_stats.sh memory_usage_queries.sh memory_usage_test.sh Once the table ti2 has been created and populated with data as shown above, run the script as follows: ./memory_usage_test.sh $(pidof mysqld) Note that this is a crude script, so it must be run from mysql-test dir. The script above will increase allowed tmp table size to 256M, and will execute the following query in 16 concurrent sessions for 300 seconds: select c2 from ti2 order by rand(); At the end of the test it will execute FLUSH TABLES. During the entire period the script will gather memory usage stats of mysqld and store it in a file memory_usage.log You can check this file to see memory usage through out the test. During my run of the script, RSS of MySQL starts at ~54092K and ends up at 1268324K even after the queries have finished executing. Only after FLUSH TABLES is executed does RSS go down to 89316K. The memory is clearly not being released properly. I have also attached my.cnf file used, though its the one auto-generated by mtr.